ceciliamtz
asked on
Date format for a TIMESTAMP field
Hello
I have a timestamp field on my MySQL DB but I can't get it to show the right way on my pages.
Taking an example from my DB:
TIMESTAMP filed shows: 20040929064953 which is correct
This is the PHP code I am using to format it on my pages:
<?php echo date('d/m/Y',strtotime($ro w_rsOrden[ 'sol_fecha '])); ?>
but I get
31/12/1969 instead of 29/09/2004
am I missing something?
Thanks
Cecilia
I have a timestamp field on my MySQL DB but I can't get it to show the right way on my pages.
Taking an example from my DB:
TIMESTAMP filed shows: 20040929064953 which is correct
This is the PHP code I am using to format it on my pages:
<?php echo date('d/m/Y',strtotime($ro
but I get
31/12/1969 instead of 29/09/2004
am I missing something?
Thanks
Cecilia
If its already a timestamp in the database then why are you using strtotime?
<?php echo date('d/m/Y',$row_rsOrden[ 'sol_fecha ']); ?>
31/12/1969 will be one second before the unix epoch, you usually get this when dealing with an invalid timestamp or an empty timestamp
<?php echo date('d/m/Y',$row_rsOrden[
31/12/1969 will be one second before the unix epoch, you usually get this when dealing with an invalid timestamp or an empty timestamp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to all who responded. I got it working with minichicken's suggestion.
Glad you it worked :)
Sorry, grammar turned bad for a second there... :p
I mean, I am gald that it worked for you :)
I mean, I am gald that it worked for you :)
ASKER
$isay = $row_Cecilia['understood'] ;
=)
=)
ASKER
and many thanks again!
a) Try double-quotes: <?php echo date("d/m/Y",strtotime($ro
b) Echo just the $row_rsOrden['sol_fecha'],
c) What type of server are you running this on?