in reply to Re: Converting dates
in thread Converting dates

Thanks it works but now the problem is
use POSIX qw(strftime); $str = "1164414128"; print strftime '%Y-%m-%d %h:%m:%S', gmtime($str);
I am getting the print 2006-11-25 00:22:08 but when I queried from the database it was
SELECT ini_Rate.tUpdate from ini_Rate where ini_Rate.tUpdate > ini_Rat +e.tEnter limit 1; +---------------------+ | tUpdate | +---------------------+ | 2006-11-25 05:52:08 | +---------------------+ SELECT unix_timestamp(ini_Rate.tUpdate) from ini_Rate where ini_Rate.t +Update > ini_Rate.tEnter limit 1; +-----------------------------------------+ | unix_timestamp(ini_Rate.tUpdate) | +-----------------------------------------+ | 1164414128 | +-----------------------------------------+
So I need to get 2006-11-25 05:52:08 but its printing 2006-11-25 00:22:08 suggest me

Replies are listed 'Best First'.
Re^3: Converting dates
by peter (Sexton) on Aug 12, 2008 at 14:54 UTC
    The %h in your strftime call should be %H, because otherwise it will be a three letter month string. The difference in time is probably a timezone difference. Here it is five and a halve hour. By using localtime you should get the right time. This is hard to test, because localtime is different for me.
    Peter Stuifzand