in reply to Re^2: Timestamp problem
in thread Timestamp problem

The value from_unixtime(1132344) should be converted into date format. If i use localtime(1132344) the value is not getting inserted
You're almost there. Use strftime from POSIX (a module that comes with perl) to convert the (list) output from localtime (or gmtime if your database is set to GMT/UT) into a string format MySQL recognizes. It should then be able to insert the dates into the database perfectly.

Replies are listed 'Best First'.
Re^4: Timestamp problem
by Anonymous Monk on Jan 01, 2009 at 22:57 UTC
    here's what you likely ended up with :
    use POSIX; $dbh->do( 'INSERT INTO announcements ( msg, start_timestamp, end_timesta +mp ) VALUES (?,?,?)', undef, 'Hello World', strftime("%Y-%m-%d %H:%M:%S",localtime(time)), strftime("%Y-%m-%d %H:%M:%S",localtime(time+2000)) );