Page 1 of 1

Dates Separation

Posted: Sat Apr 23, 2005 10:35 am
by thesimon
If i store dates in the database in the datetime form of

YYYY-MM-DD HH:MM:SS (which i believe is somehow standard, correct me if im wrong)

How in php once i have taken that date from the database, can i separate the components and store them in separate variables ($year,$month,$day...)

Posted: Sat Apr 23, 2005 11:37 am
by Chris Corbyn
If it really does come out of the database in that exact format just a substr() should do it....

Posted: Thu Apr 28, 2005 6:09 pm
by feyd
DATE_FORMAT() works wonders.

re:

Posted: Thu Apr 28, 2005 8:05 pm
by harrisonad
read the PHP manual on how to use date() function