have a question that no-one in this database either knows or like a few people that have responded to my question in the forum have given me other ways in which still dont work.
Please see
http://www.devnetwork.net/forums/viewto ... highlight=
All i really want to know is how to store this from an input box
$member_date_of_birth
Which has been typed in for example "23-10-1980"
in to a mySQL database as a TIMESTAMP(.
And how to get it out again.
back to $db_member_date_of_birth
so i can output it on another page as
"Monday 23rd October 1980"
Its simple, but yet no-one knows how to do it.
The reason i want it to be a timestamp is because i need it to be sorted within the database, when i run a query.
And also so i can manuiplate the date for example adding two dates together and working out the age of a member.
Can you help? Thanks for reading this anyway.
Cheers,
SteJ.
CODE To enter a TIMESTAMP(8) into a mySQL database
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
To change it to MySQL timestamp format:
http://www.php.net/manual/en/function.explode.php
To then format that date when getting it out of MySQL use one of MySQL's date and time functions:
http://www.mysql.com/doc/en/Date_and_ti ... tions.html
Mac
Code: Select all
$date = '23-10-1980';
$dateinfo = explode('-', $date);
$mysql_date = $dateinfo[2].$dateinfo[1].$dateinfo[0];To then format that date when getting it out of MySQL use one of MySQL's date and time functions:
Code: Select all
SELECT DATE_FORMAT(date, '%W %D %M %Y') AS date FROM tableMac