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.
Suggestions on how timestamp should be used
Moderator: General Moderators
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
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.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.
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.