Hi
I have a list of dates that have been converted to epoch seconds, processed
and then converted back to a string (using timelocal). The resulting date
format is:-
Wed Mar 16 22:10:16 2004
What is the easiest way to convert this format (or epoch seconds) to
16-Mar-2004 22:10 - preferrably
Hi
I have a list of dates that have been converted to epoch seconds,
processed
and then converted back to a string (using timelocal). The resulting date
format is:-
Wed Mar 16 22:10:16 2004
What is the easiest way to convert this format (or epoch seconds) to
16-Mar-2004 22:10 -
John Bruin wrote:
I have a list of dates that have been converted to epoch seconds,
processed and then converted back to a string (using timelocal).
The resulting date format is:-
Wed Mar 16 22:10:16 2004
What is the easiest way to convert this format (or epoch seconds)
to 16-Mar-2004 22:10 -
The
9:35 a.m.
To: John Bruin; [EMAIL PROTECTED]
Subject: Re: Newbie needs help changing date format
Hi
I have a list of dates that have been converted to epoch seconds,
processed
and then converted back to a string (using timelocal). The resulting
date format is:-
Wed Mar 16 22:10:16 2004
Could someone tell me why this is happening? When I use this command, it
used to give me 20010405.doc (mmdd.doc), now it's giving me 2001 4 5.doc
- I'm losing the leading zeros.
Command is on Perl 5 - printf(\%s%02s%02s.doc,$year,$month,$day).
Thanks.
On Tue, Apr 24, 2001 at 11:00:40AM -0500, Arante, Susan wrote:
: Could someone tell me why this is happening? When I use this command, it
: used to give me 20010405.doc (mmdd.doc), now it's giving me 2001 4 5.doc
: - I'm losing the leading zeros.
: Command is on Perl 5 -
Hi Susan,
I get what you expect:
perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)';
20010405.doc
Personally, I like POSIX.pm for dates.
# perl -MPOSIX -wle 'print strftime(%Y%m%d, localtime) . .doc';
20010424.doc
'perldoc POSIX' to learn more (look for strftime).
Cheers,
Kevin
: Help on Date Format
Hi Susan,
I get what you expect:
perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)';
20010405.doc
Personally, I like POSIX.pm for dates.
# perl -MPOSIX -wle 'print strftime(%Y%m%d, localtime) . .doc';
20010424.doc
'perldoc POSIX' to learn more (look for strftime
On Tue, Apr 24, 2001 at 01:09:13PM -0400, Kevin Meltzer wrote:
Hi Susan,
I get what you expect:
perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)';
20010405.doc
[snip]
Well I'll be damned.
[ ~ ] perl -e 'printf %04s\n, 1'
0001
[ ~ ] perl -e 'printf %04s\n, 1'
0001
[ ~ ]
In this case, it wont really matter. Since 1 and 1 is essentially the same.
If you were actually using a signed integer (in decimal), then you would see
the difference:
From perldoc -f sprintf:
%s a string
%d a signed integer, in decimal
[root@fluffhead /]# perl -e 'printf %04s\n,
10 matches
Mail list logo