Hey guys,
I Wan't to insert the date and time into my database when some one makes a new post and then I plan to write a simple script that eaither adds or subtracts from date and time to make them acurate depending on the time zone they are in. I think Current_Timestamp inserts the time stamp from the users computer which would really screw up the times. What can I use to make the time equivilent to what time is on the server . It would be ideal to have the date and the time in two diffrent fileds but not a nesesity.
Date and Time
Started by zeroradius, Feb 01 2009 11:21 AM
2 replies to this topic
#1
Posted 01 February 2009 - 11:21 AM
|
|
|
#2
Posted 01 February 2009 - 11:58 AM
I would store the time in GMT, and let the users enter their offset from GMT (I'm -5).
#3
Posted 01 February 2009 - 12:21 PM
MySQL is what I'm talking about here.
CURRENT_TIMESTAMP is an setting on a field, and and gives the time on row insertion.
a field can have a type TIMESTAMP, which is updated to current time on each change/update etc.
to set current date and time, there are functions CURDATE(), CURTIME() and CURRENT_DATETIME() to be used within the queries. ther eis also the possibility to use UNIX_TIMESTAMP() if you want the unixstyle timestamp.
all these functions uses the server time, and not the user time.
CURRENT_TIMESTAMP is an setting on a field, and and gives the time on row insertion.
a field can have a type TIMESTAMP, which is updated to current time on each change/update etc.
to set current date and time, there are functions CURDATE(), CURTIME() and CURRENT_DATETIME() to be used within the queries. ther eis also the possibility to use UNIX_TIMESTAMP() if you want the unixstyle timestamp.
all these functions uses the server time, and not the user time.


Sign In
Create Account



Back to top









