?
Solved

convert unix timestamp to regular date time

Posted on 2009-07-04
4
Medium Priority
?
1,974 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
0
Comment
Question by:elektroshock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
Mohed Sharfi earned 2000 total points
ID: 24778883
Hi elektroshock,
Please try this: SELECT unix_timestamp(now())
thanks
0
 
LVL 7

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
thanks

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

Open in new window

0
 

Author Comment

by:elektroshock
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
0
 
LVL 7

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.
thanks
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

800 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