Jump to content

PHP Date-Time to SQL Date-Time and vice versa?


scott.stephan

Recommended Posts

In the current app I'm working on, there are a lot of functions that use dates and time to trigger certain actions. I like PHP DATE stuff because you can perform easy arithmetic on it. I like SQL DATETIME because you can store all of your time data in one chunk instead of having order_hour, order_minute, order_day, order_month etc. etc,.

 

What I'm a little unsure of is how PHP and SQL are going to play along when it comes to dates. Honestly, it seems like it may be a pain to pull a date from SQL and parse it into usable pieces. Does anyone have a guide or an article on the challenges of swapping between SQL and PHP with regards to DATE/TIME stuff?

Link to comment
Share on other sites

Mysql has a large number of built-in date and time functions, which are more useful and capable than what php currently has, that make using php code unnecessary for most tasks (and php code to accomplish the same task is also several times slower.)

 

Ref: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.