Page 1 of 1
date question
Posted: Sat Oct 12, 2002 9:29 pm
by qads
Hi,
I used date("d/m/Y"); to store the current date in the mysql db, so I have dates like 13/10/2002, is there any way I can change them to a different format? e.g. Sunday 13th Oct, 2002
this will really be useful if some one knows how to do it, I could do it one by one but then again....why am I learning PHP?
thanks alot for your time
- Qads
Posted: Sat Oct 12, 2002 10:41 pm
by mydimension
for complete date() reference see:
http://www.php.net/date
here is a line that could work for you:
date("l m dS M, Y");
Posted: Sun Oct 13, 2002 2:48 am
by Takuma
Best to use Timestamp. Checkout
mktime().
Timestamp are much easier to change the format.
Posted: Sun Oct 13, 2002 8:24 am
by qads
thanks guys but i need to convert the old dates in to this format, i could't find any examples on php.net either :/.
thanks
- Qads
Question
Posted: Sun Oct 13, 2002 10:19 am
by AVATAr
Do you want to display them with the new format?, or, do you want to store them in the new format?
In both cases, check date();
Posted: Sun Oct 13, 2002 12:14 pm
by twigletmac
Also consider having actual DATE or TIMESTAMP columns in your database instead of storing your dates in VARCHAR ones. Then you can have MySQL do all the work of converting your dates into whatever you want each time you extract them.
http://www.mysql.com/doc/en/DATETIME.html
http://www.mysql.com/doc/en/Date_and_ti ... tions.html
Mac
Posted: Sun Oct 13, 2002 12:52 pm
by hob_goblin
Posted: Sun Oct 13, 2002 4:17 pm
by qads
hmm, quite useful links

...thanks!