Storing Dates in Drupal DB

gareth_w - January 24, 2008 - 13:38

Hi All,

I need to port a load of users from joomla to Drupal. I have a script to most of it, apart from the dates (first registered, last login, etc).

Joomla gives the dates as "2006-08-15 22:53:03"

Drupal stores dates in (my) MySQL as "1186599292"

These are both generated by the same host/account - so no differences there.

I'm guessing the Drupal date format is the Unix/Linux seconds since the epoch type format, but can anyone point me at a web page/script/service/formula to convert these?

Many thanks,
Gareth

Use the unix_timestamp()

bonaparte - January 24, 2008 - 14:10

Use the unix_timestamp() function in your query. And then manipulate it with PHP's date() function.
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#func...
http://in.php.net/date

Good luck.
--------------------
Sudheer. S
Binary Vibes Information Technologies Pvt. Ltd.
Learn and and help others learn Linux, Apache, MySQL and PHP
Avail commercial Drupal services

Cheers!

gareth_w - January 25, 2008 - 09:16

I think I see how that works in the SQL query- I'll give it a whirl!

Gareth

http://ch2.php.net/date

mkalbere - January 24, 2008 - 14:17
 
 

Drupal is a registered trademark of Dries Buytaert.