convert unix timestamp to regular date time

Posted on 2009-07-04
Last Modified: 2012-06-21
Hi all,

What would be the best way to convert a unix timestamp column in a mysql db to a regular date and time?

im new to sql so any help, links would be great
Question by:elektroshock
  • 3

Accepted Solution

Mohed Sharfi earned 500 total points
ID: 24778883
Hi elektroshock,
Please try this: SELECT unix_timestamp(now())

Expert Comment

by:Mohed Sharfi
ID: 24778896
Hi elektroshock,
how are you,that example to convert a normal datetime to unix timestamp
this sample code to convert a unix timestamp  to a regular date and time

mysql> SELECT FROM_UNIXTIME(1111885200);

-- Result: 2005-03-27 03:00:00       

Open in new window


Author Comment

ID: 24778940
thats great thank you :)

any idea on how to transform an entire column that has been moved to a new db?

the column contains all unix timestamp data but the column is now varchar

thanks again

Expert Comment

by:Mohed Sharfi
ID: 24779494
Hi elektroshock,
are you fine?
regarding to transform col. into new DB My idea is keep your col. type in timestamp or datetime to get validation layer from DB.

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

I have been using r1soft Continuous Data Protection ( for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at

762 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

19 Experts available now in Live!

Get 1:1 Help Now