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
https://forums.phpfreaks.com/topic/247860-date-formatting/
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
https://forums.phpfreaks.com/topic/247860-date-formatting/#findComment-1272729
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
https://forums.phpfreaks.com/topic/247860-date-formatting/#findComment-1272734
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.