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 }
In reply to Converting dates by denzil_cactus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |