Page 1 of 1

Suggestions on how timestamp should be used

Posted: Sun Jul 03, 2005 4:05 am
by raghavan20
Whenever it comes to storing time on the db I have the following questions
1. Is it gd to give Current_timestamp at the db field?
2. Or do I have to set the Date using php code?
3. how this date_format() function can be used?
4. Is it possible to get global timings because my hosting service is in US, they display US timing when I use current_timestamp but I am building sites for UK clients.

Posted: Sun Jul 03, 2005 5:08 pm
by neophyte
1. Is it gd to give Current_timestamp at the db field?
2. Or do I have to set the Date using php code?
3. how this date_format() function can be used?
4. Is it possible to get global timings because my hosting service is in US, they display US timing when I use current_timestamp but I am building sites for UK clients.
1. I like storing unix time stamps because it lends itself to doing <> comparisons in sql. But there are ways to get around that. If you do anything with dates the first thing is almost always a comparison and thats easier done with time stamps.

2. You can use UNIX_TIMESTAMP() in mysql to generate a timestamp or NOW() to get the date.

3/4/ Read the time manual. I've never had to do time zone stuff but I know that there are ways to do that.