Solved

Decrypt a date stored in a MySQL varchar

Posted on 2004-10-15
3
421 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
Comment Utility
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
Comment Utility
0
 
LVL 27

Expert Comment

by:Diablo84
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now