CodeIgniter Forums
Timestamp Troubles - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Timestamp Troubles (/showthread.php?tid=42240)



Timestamp Troubles - El Forum - 05-31-2011

[eluser]Konvurt[/eluser]
I have a snippet of code where I want to show the date and time for every time a client uses a discount card. Clients can not have more than two entries per card. However, when I try to display the two entries with the appropriate formatting only the older timestamp formats properly. Code below:
Code:
Last Used:
<?php

$timestamp = mysql_to_unix($row->trans_date);  //MySql Time stamp 2011-05-31 12:49:59
date_default_timezone_set('America/Chicago');  //Push timestamp ahead 2 hours
$lastuse = date('F j, Y @ g:i A', $timestamp); //format date
    
    echo $lastuse;
    

?>
<?php endforeach; ?>

I have two timestamps coming in 1306871399 and 1306864204. The first stamp successfully processes as May 31, 2011 @ 2:49 PM, but the second comes out May 31, 2011 @ 12:50 PM.

I am not understanding why only one of the timestamps are being processed. Your feedback is appreciated.


Timestamp Troubles - El Forum - 05-31-2011

[eluser]TWP Marketing[/eluser]
Try echoing the value of $timestamp before and after you change timezones.