Page 1 of 1
time & date
Posted: Sun Jun 19, 2011 4:16 pm
by ashwood
How would i send time to the database like
hours minutes (5:55PM)
and date like
day/month (11/03)
i want them in to seperate varibles ive googled it but alls ive found is them together
date("d/m/y : H:i:s", time());
but i want to send them to the database as ive put and seperate
thanks
Re: time & date
Posted: Sun Jun 19, 2011 4:21 pm
by Torniquet
so you want a single field for the individual parts of the date and time?
to break them up into individual variables, assign each one individually.
$day = date("d", time());
$month = date("m", time());
... etc
Re: time & date
Posted: Sun Jun 19, 2011 4:35 pm
by ashwood
Torniquet wrote:so you want a single field for the individual parts of the date and time?
to break them up into individual variables, assign each one individually.
$day = date("d", time());
$month = date("m", time());
... etc
no i want
time as $time = 5:55PM or whatever the current time is but as that format
date as $date = 10/03 (day/Month) or whatever the current date is but as that format
Re: time & date
Posted: Sun Jun 19, 2011 4:48 pm
by jacek
If you store the time as a DATETIME column you can then use the DATE_FORMAT() mysql function to format it how you like when selecting the data.
Re: time & date
Posted: Sun Jun 19, 2011 4:50 pm
by ashwood
jacek wrote:If you store the time as a DATETIME column you can then use the DATE_FORMAT() mysql function to format it how you like when selecting the data.
expand on this please? first time ive heard anything about this?
Re: time & date
Posted: Sun Jun 19, 2011 5:15 pm
by Temor
ashwood wrote:jacek wrote:If you store the time as a DATETIME column you can then use the DATE_FORMAT() mysql function to format it how you like when selecting the data.
expand on this please? first time ive heard anything about this?
http://www.w3schools.com/sql/func_date_format.asp
Re: time & date
Posted: Sun Jun 19, 2011 7:31 pm
by jacek
The link in the above post has all the info
do you have any specific question ?