Solved

convert unix timestamp to regular date time

Posted on 2009-07-04
4
1,967 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
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
Mohed Sharfi earned 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CLI command keep running after close 7 56
sql server query 12 32
How to structure query with count aggregate 4 42
How to keep a record with the highest value 3 38
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 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