PDA

View Full Version : (MYSQL) Converting a populated column of datetime to timestamp


dcdub
12-20-2005, 02:14 AM
Hey i have a column in my DB thats a datetime i need to convert all the records on mass to a timestamp.

ive got well over 2500 records like this so going through them one by one is not an option.

anyone able to help me with a php script that when run would convert them to timestamp?

i need to convert a subscription addon for another forum software to VB and this is the only thing that wont match

Any help much appreciated

Dub

Zubaz
12-21-2005, 11:41 PM
you would probably enjoy this function:
http://us2.php.net/mktime

You'll have to break your datetime's apart using explode() or something, but you can construct your actual timestamps using mktime()

Marco van Herwaarden
12-23-2005, 10:36 AM
What is the columntype of the old database, and please provide some example values.

Also see:
http://dev.mysql.com/doc/refman/4.1/en/datetime.html
http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html