Jump to content

Date function help?


DarrenReeder

Recommended Posts

Hello..

 

On my site i have made my own 'mini' forums and im trying to make them order propaly so i original used the date() function save save the date into the mysql database like..

 

date(y-m-d)

 

but that only saves the Year, month and day so it cant be orderd propaly...how can i make this save it so its Y-M-D, Hour,minute,Second ???

 

**P.S. im updated the original thread in the record everytime someone posts a reply and when the thread is made, and when i use the loop to display it all i make sure its order to the 'LastReply' DESC**

Link to comment
Share on other sites

The query that you supplied simply updates the thread's views when somebody looks at the thread. My code is for when somebody creates a thread. Post your creation query and I will amend it accordingly.

 

Oh, and to sort by date AND time, on your select query after the WHILE clauses add:

 

ORDER BY datetime DESC // datetime being your field name for the date/time

 

EDIT:

 

$insert = mysql_query("UPDATE threads SET ReplayLast=NOW() WHERE ID='$threadid'") or die(mysql_error());

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.