| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
I've got a table called quotes and one of the columns has a field named datesent.
I set this column up as:
Field = datesent
Type = timestamp
Attributes = on update CURRENT_TIMESTAMP
Default = CURRENT_TIMESTAMP
When the form data is sent to the mysql db the datesent cell is populated with 2010-09-06 15:04:05 which is what I needed.
Now I'm trying to retrieve it, reformat it to 06-09-2010 15:04:05, and display it to user.
Is there anything like mysql_insert_id() which will enable me to retrieve the time stamp data rather than the last AI field or will I have to find another way wth php.
Any help or pointers would be a great help.
select date_format('2010-09-06 15:04:05',"%m-%d-%Y %H:%i:%s") as reformatted;
-> 09-06-2010 15:04:05
12 hour clock,
select date_format('2010-09-06 15:04:05',"%m-%d-%Y %h:%i:%s %p") as reformatted;
-> 09-06-2010 03:04:05 PM
Just sub your field name for the hard coded date, like
$query = "select date_format(your_field_name,"%m-%d-%Y %h:%i:%s %p") as reformatted from table where id=$id";
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved