Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I'm pulling two fields into a database (reading out of text files into php, submitting into an empty tables, and will read from the text files every 20 min and update the tables if anything changes) and I need to store epoch time values. Do I use DateTime for this? Won't it automatically convert the epoch times to human readable? Do I need to convert the epoch time to human readable before storing it in the database and then convert it back to epoch time when selecting it again later?example of time from text file: 1331070999
robvolk
Most Valuable Yak
15732 Posts
Posted - 2012-03-06 : 17:20:26
You can import that to an integer column and add a computed column to convert it to a datetime:
create table epoch(epoch int not null, epoch_date as dateadd(s,epoch,'19700101'))insert epoch(epoch) values(1331070999)select * from epoch