denzil_cactus has asked for the wisdom of the Perl Monks concerning the following question:
In the above code, tUpdate and tEnter are dates and I have converted them into unix timstamp for comparing but now I need to convert back to yyyy-mm-dd hh:mm:ss format i.e mysql datetime field format. Can anyone advise me how to convert it?my $query = "SELECT DISTINCT ID,unix_timestamp(tUpdate) as t,unix_time +stamp(tEnter) as p from ini_Rate where tUpdate > tEnter limit 5 "; $sth = $dbh->prepare($query); $sth->execute(); while ( my $row = $sth->fetchrow_hashref) { my $cRequest = ""; my $cTratupdated = ""; if($row->{t} > $row->{p}) { { $cRequest = "U"; # Update $ctupdate = $row->{tUpdate}; } else { $cRequest = "N"; # New }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Converting dates
by ejaincom (Novice) on Aug 12, 2008 at 08:46 UTC | |
by denzil_cactus (Sexton) on Aug 12, 2008 at 09:04 UTC | |
|
Re: Converting dates
by Corion (Patriarch) on Aug 12, 2008 at 06:59 UTC | |
by denzil_cactus (Sexton) on Aug 12, 2008 at 08:57 UTC | |
by peter (Sexton) on Aug 12, 2008 at 14:54 UTC | |
|
Re: Converting dates
by dHarry (Abbot) on Aug 12, 2008 at 07:04 UTC | |
|
Re: Converting dates
by Anonymous Monk on Aug 12, 2008 at 07:32 UTC | |
|
Re: Converting dates
by chrism01 (Friar) on Aug 13, 2008 at 05:19 UTC |