Converting Date & Time Format from mysql in php

princeoo7

On a Journey called Life :P
Skilled
Guy's I want to display date and time in an html / php page which are been recorded in mysql when record was inserted
<


the current code displays it in the following way

Code:
 <?php echo $row_articals['publicationDate']; ?>

Code:
 2012-05-08 23:55:48

so now is it possible to change that format while fetching data from mysql and having the date like " 9 May 2012 " and time in 12 hrs format with am / pm .

Thank you for reading
<


Have a nice Night / day ahead.
 
#challapardyuma:

My Problem is that the dates and time are stored under the
Code:
publicationDate
column.

they are stored into e.g.= " 2012-05-08 23:55:48 " format .

I did tried what you suggested and still failed to achieve what I want.

what else can i do ????

I have seen something about UNIX timestamp and them something something .........

But don't know how to use it .

I am still an beginner in php but there is an need of this task and so needed help regarding it
<


Thank for so faster reply
<
 
[font=helvetica, arial, sans-serif]echo date("j",strtotime([/font]$row_articals['publicationDate'][font=helvetica, arial, sans-serif])); [/font]

No " " for variables .
 
I am facing a strange problem :/

I am now getting my desired out put .It worked First time but second time on the same page it's not working

Second time Code :

Code:
 <?php echo date("D, j F, Y h:i:s a",strtotime($row_articals['time']));  

           ?>

Output :
Code:
 Thu, 1 January, 1970 01:00:00 am

mow where did january , 1970 came from i don't know
<
and the time is also wrong, from what is there in mysql database.

First one is working properly with same code
<
 
it is the start of standard Unix time. When you use strtotime you get the total no of seconds after the standard UNIX time. There should be something wrong with the format you are using inside the Data function. What is the format you want i'll get it for you.
 
Oh MyBad
<


I found the mistake I was making
<


I was fetching data form two different tables with one code which contented only one table name
<


now every thing is working awesome
<


Thank you guys for helping me out
<
 
Back
Top