We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

convert unix timestamp to regular date time

elektroshock
elektroshock asked
on
Medium Priority
2,016 Views
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
Comment
Watch Question

Vice CEO
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Mohed SharfiVice CEO

Commented:
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
thanks

mysql> SELECT FROM_UNIXTIME(1111885200);
 
-- Result: 2005-03-27 03:00:00       

Open in new window

Author

Commented:
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
Mohed SharfiVice CEO

Commented:
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.
thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.