Decrypt a date stored in a MySQL varchar

Hi all,

I currently use postNuke and its module pnCommerce, and in a MySQL (MyISAM) table, some dates are stored in varchar(100) columns.

Therefore I have values such as :
- 1081977682
- 1086186475

As you can see, it is difficult to understand.

Do you know a method to translate in a "readable" format ?

TIA
LVL 1
Richard Coffree-commerce Product ManagerAsked:
Who is Participating?
 
Diablo84Connect With a Mentor Commented:
They are just unix timestamps so you can use the date function to format them. eg:

$stamp = "1081977682";
echo date("d-m-Y",$stamp);
0
 
Diablo84Commented:
0
 
Diablo84Commented:
basically the first parameter is the format and the second is the timestamp

So within the first parameter you can build a formated date from the stamp using the format characters (as shown in the manual page). My example above will return the date in dd-mm-yyyy format, a more extended example from the manual:

echo date("l dS of F Y h:i:s A");

will return the date in a format similar to: Wednesday 15th of January 2003 05:51:38 AM
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.