Forums
This topic is locked
Formatting date in PHP
Posted 11 Mar 2007 18:44:01
1
has voted
11 Mar 2007 18:44:01 Darryl Lennon posted:
HiI'm trying to format a Timestamp which is one of the fields in a DB table.
On the member's profile page, I'm trying to display the date that that user joined up (or when the record was inserted!).
Here is the code I am using: (space inserted after the '<' to get code to show!)
<pre id=code><font face=courier size=2 id=code> < ?php echo date('l dS \of F Y h:i:s A', $row_rsPersonalUser['joined']); ?> </font id=code></pre id=code>
but - when I view the page I'm getting the following output:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote> Member since Thursday 01st of January 1970 01:33:27 AM <hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
What's going wrong with my code? It's probably right under my nose but I just can't find it <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
Thanks in advance
Darryl L.
** PS: rsPersonalUser is the recordset in Dreamweaver 8 that I am using to call the info, and the field in the DB is called 'joined'. **
Replies
Replied 12 Mar 2007 19:23:03
12 Mar 2007 19:23:03 Alan C replied:
1 jan 1970 is the start of the unix era, that suggests that whatever is in the field is actually zero - you could have a look at the record with phpmyadmin and check exactly what is there.
I get messed up with these date formats too!
I get messed up with these date formats too!
Replied 13 Mar 2007 17:31:18
13 Mar 2007 17:31:18 Roddy Dairion replied:
try this
<?php echo date('l dS \of F Y h:i:s A', strtotime($row_rsPersonalUser['joined'])); ?>
<?php echo date('l dS \of F Y h:i:s A', strtotime($row_rsPersonalUser['joined'])); ?>