Jump to content

Dates/Times


Mutley

Recommended Posts

I'm making a really basic forum.

 

When users post I want it to say "Latest post: (TIME) (DATE)" in say 22:00, then date as DD/MM/YY

 

When I insert it into the database do I want my field to be configured as "DATE" and a field configured as "TIME" or should I use VARCHAR? But I also noticed it doesn't insert it in DD/MM/YY, it does MM/DD/YY or something weird?

 

To insert do I just do time() and date()?

Thanks.

Link to comment
Share on other sites

No that's nothing what I mean.

 

In my database I have a field called "time" which is set to "timestamp" configuration.

 

In my PHP file I want to display this so I have a SQL query that calls this field. What I want to know is how to format the field in my PHP file.

Link to comment
Share on other sites

This is what I tried:

 

		// START NORMAL TOPICS:
			$sql  = "SELECT topic_id, user_id, section_id, DATE_FORMAT(time,'D M j G:i:s T Y') AS times, sticky, title, content FROM bb_topics WHERE section_id = '$section' AND sticky = '0' ORDER BY topic_id DESC";

 

But doesn't work...

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.