Solved

Decrypt a date stored in a MySQL varchar

Posted on 2004-10-15
3
432 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:Richard Coffre
  • 3
3 Comments
 
LVL 27

Accepted Solution

by:
Diablo84 earned 500 total points
ID: 12319836
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
 
LVL 27

Expert Comment

by:Diablo84
ID: 12319847
0
 
LVL 27

Expert Comment

by:Diablo84
ID: 12319876
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

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question