Jump to content

Date formatting


NiallThistle

Recommended Posts

I'm going round in circles with this one, but I have a feeling that the answer is obvious.  I have POST information that I want to use as a date and display it using date format, but I don't know how to

 

The POST data outputs the following: 2011-9-23

 

Assuming I have defined $date as the posted data from the previous form, how do I write some code to tell it to output it as September 23, 2011, or just Sept 2011?

Link to comment
Share on other sites

I was actually reading that very site about an hour ago.  Can't make head nor tail of it, in terms of context, how I should adapt what I have.

 

Essentially what I have just now is:

 

echo"$date";

 

And that outputs the basic SQL entry format of '0000-00-00'.

 

Can anyone suggest a basic way to write the line I wrote above, to add formatting to the date?

Link to comment
Share on other sites

Does your date format have leading 0's for the day or month?

 

i.e. is it always 9 for September and not 09? If the day is 5, is it 5 or 05? So for September 5th 2011 will it be 2011-9-5? or 2011-9-05?

 

Also, what version of PHP do you have?

 

PHP v4

 

The date could be anything, but the info is taken from three drop downs (day, month and year) in a form on the previous page.

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.