Solved

Decrypt a date stored in a MySQL varchar

Posted on 2004-10-15
3
427 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
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…

863 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

26 Experts available now in Live!

Get 1:1 Help Now