Using DreamweaverMX, PHP and MySQL/PHPadmin:
I'm trying to figure out how to use the "DATE_FORMAT('%Y,%m,%d')" to format my timestamp data coming from my database like "2004-01-01"....can't figure out the exact way to add the php code to my recordset data field so that it will work?
<?php echo $rs_requestview->Fields('request_date'); ?>
I've tried lots of things, still no luck.
Thanks!
Lynne
Formating a timestamp from database
Moderator: General Moderators
Try this :
date_field is date type
'%W %M %Y' gives: Monday 4th November 2002
more here date_format
Dr Evil
Code: Select all
<?php
$query= "SELECT DATE_FORMAT(date_field, '%W %D %M %Y') AS formatted_date FROM table";
?>'%W %M %Y' gives: Monday 4th November 2002
more here date_format
Dr Evil
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England