0

All,
Im guessing this is going to be easy for any one to answer bc im such a fucking noob but here goes. I have mysql fields set to DATETIME and i just want to pull out that data and have it display in my form. And i would also like to know how to insert a date into a mysql DATETIME field if you guys would be so kind as to assist. I really really would appreciate any help. Thanks guys

3
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by simplypixie
0

ALso, I have answered this question (or similar) about 3 times recently on this forum - have you tried searching the forum for the answer?

0

well thats the thing guys, im not really sure what i should look for. I googled every possible string i could think of that made sense but i couldnt find (or make sense of) my answer. I will continue to search though, thanks anyway fellaz. I appreciate your time

Edited by Red_Rain: n/a

0

OK to format the date and time as 13/01/2012 08:15 AM using 24 hour format (for example), $row would be the variable you are storing your result from the database in:

$datetime = date('d/m/Y H:i A', strtotime($row['datetime']));
echo $datetime;

If you only need the date then take out H:i:A
To change it back to insert into the database

$datetimefordatabase = strtotime($_POST['date_time']);

Even though php.net is a nightmare to use, their list of date and time formats is useful and can be found here

Edited by simplypixie: n/a

1

Even though php.net is a nightmare to use...

You can't be serious?!

0

I couldnt agree more pixie!! I hate that effing website, its descriptions are extremely confusing to a noob like me and i thought i was making really good progress learning this stuff on my on lol but seriously dude, what you wrote out for me makes PERFECT sense so i cant be that big of a noob (ok, dont comment to that). Thanks a million man, you are truly helpful.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.