Nesh has asked for the wisdom of the Perl Monks concerning the following question:
Now the question is that this does not seem to be a very good approach. as incase I try to increment the month just before the "join" the date will again have single digit month. So is there a better approach to simply get the date in mm/dd/yyyy format so that it can be compared with oracle database date format. Thanksmy ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(tim +e); my $currSysDate; my $currYear; my $day; $year = $year + 1900; $mon = $mon+1; $day = $mday; if($mon <10){ $mon ="0$mon"; } if($day <10){ $day ="0$day"; } $currSysDate = join("/",$mon,$day,$year); print "$year \n"; print "$currSysDate \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Formats for date.
by gellyfish (Monsignor) on Jun 28, 2005 at 21:33 UTC | |
|
Re: Formats for date.
by BaldPenguin (Friar) on Jun 28, 2005 at 21:48 UTC | |
by ikegami (Patriarch) on Jun 28, 2005 at 21:51 UTC | |
by BaldPenguin (Friar) on Jun 28, 2005 at 23:21 UTC | |
|
Re: Formats for date.
by shiza (Hermit) on Jun 28, 2005 at 23:58 UTC | |
|
Re: Formats for date.
by fmerges (Chaplain) on Jun 28, 2005 at 22:13 UTC |