Jump to content

Dealing with times and dates


tibberous

Recommended Posts

I need to ask the user for a start time and date, and then save it. Then I need to ask them how long they want something to show up.

 

When someone visits the site, I need to make something show up if it is after the start time but still during the show time.

 

I don't know whether I should try and use mysqls date and time functions, or if I should just use phps timestamps for everything and just put ints into the database.

Link to comment
Share on other sites

Have a table with start_time and end_time. Both TIMESTAMP. The start_time is the time the user wants that thing to show up and the end_time is when it will stop. In the application, you don't have to make the user select an end_time, you can convert that using PHP before storing it in the DB.

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.