in reply to Re: Convert date format in database table.
in thread Convert date format in database table.
my $date = '2/3/1906'; my $new_date = sprintf("%04d-%02d-%02d 00:00:00",(split /\//, $date)[2 +,1,0]); # $new_date is "1906-03-02 00:00:00"
cLive ;-)
Update: As tachyon points out, I misread the question - the phrase "must be all zeroes" threw me :)
But again, I still say split :)
my $new_date = sprintf("%04d-%02d-%02d %02d:%02d:00",(split /\D+/, $da +te)[2,1,0,3,4]);
:)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Convert date format in database table.
by tachyon (Chancellor) on Oct 07, 2003 at 06:18 UTC | |
by cLive ;-) (Prior) on Oct 07, 2003 at 06:23 UTC | |
by tachyon (Chancellor) on Oct 07, 2003 at 12:11 UTC | |
|
Re: Re: Re: Convert date format in database table.
by runrig (Abbot) on Oct 09, 2003 at 01:57 UTC |