|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Getting the date from mysql and formatting with PHP
Right, first, I am new to the boards, so hi to everyone.
My problem: I am creating a news...thing with php and mysql. ATM I am trying to get the date each date was posted to show up on each post (If you see what I mean) using the timestamp type in mysql. I can get it to show up fine, but only as 20030215044014 or similar. Any idea on how to format it. Thanks for any help. Link |
|
#2
|
|||
|
|||
|
RE: Getting the date from mysql and formatting with PHP
You can format the timestamp right from your query. For example:
Code:
$query=SELECT date_format(ts_column_name,'%W %M %c %Y %r') FROM table_name WHERE id=5; will output(assuming the timestamp you posted): Saturday February 2 2003 04:40:14 AM You can find more on this here: http://www.mysql.com/doc/en/Date_and_time_functions.html |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Getting the date from mysql and formatting with PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|