Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 2004 22:25:41 +0100
From:      Shaun Friedle <shaun@insipidity.co.uk>
To:        JJB <Barbish3@adelphia.net>
Cc:        freebsd-questions@FreeBSD.org
Subject:   Re: timezone command
Message-ID:  <1082150741.280.13.camel@Shaun>
In-Reply-To: <20040416161750.GA33400@happy-idiot-talk.infracaninophile.co.uk>
References:  <20040416050053.GA52342@falcon.midgard.homeip.net> <MIEPLLIBMLEEABPDBIEGGEBBFMAA.Barbish3@adelphia.net> <20040416161750.GA33400@happy-idiot-talk.infracaninophile.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2004-04-16 at 17:17, Matthew Seaman wrote:
> You can do it very easily with perl:
> 
>     #!/usr/bin/perl -w
> 
>     use POSIX (strftime);
> 
>     ($d = strftime("%z", localtime)) =~ s/(\d\d)(\d\d)/$1:$2/;
> 
>     print "$d\n";
> 
> but it's probably a bit too heavyweight to use perl to format the
> string if you aren't already writing a whole script in perl.  Instead,
> try:
> 
>     date +%z | sed -e 's,\([0-9][0-9]\)\([0-9][0-9]\),\1:\2,'
> 
>       Cheers,
> 
>       Matthew


Oops, didn't notice this because it was in a different thread. Well now
you  have two Perl solutions :)
-- 
Shaun Friedle



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1082150741.280.13.camel>