0

I'm trying to migrate data from one application to another via SQL imports, and I'm at the final step of grabbing the date of entry. The difficulty I'm experiencing is that the date is in some odd format.

Examples are as follows... 1360938606 1360938612 1360938607 1360938607

In the new application, the date format is as follows: 0000-00-00 00:00:00

Is there a way that I can convert the original format to this new format in Excel?

Thanks!

Brian Schroeter
  • 1,583
  • 5
  • 22
  • 41
  • 1
    Looks like a unix timestamp value rather than an Excel timestamp value: 1360938606 is 2013-02-15 – Mark Baker Mar 12 '13 at 22:16
  • That's what I was thinking. – Brian Schroeter Mar 12 '13 at 22:18
  • So how are you writing to Excel? – Mark Baker Mar 12 '13 at 22:19
  • Well, I did an export of the data from the database (into a CSV) and I'm doing all of the mapping manually (in an excel document). As a result, I'm trying to find a way to convert the Unix timestamp to the format posted above (essentially YYYY-MM-DD). – Brian Schroeter Mar 12 '13 at 22:21
  • If you're just writing CSV, then a simple date('Y-m-d',1360938606) watch out for potential timezone issues with unix timestamps; if you're writing OfficeOpenXML (xlsx) or BIFF (xls) then your library should provide date conversion functions to write Excel timestamps – Mark Baker Mar 12 '13 at 22:22

2 Answers2

0

Looks like unix timestamp ad Mark mentioned... which is actually pretty standard. You can use strftime from php to convert it to the string format you want:

$time = strftime('%F %T', (int) $thevalue)

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
0

You can also try this :

$newdateformat = date('Y-m-d H:i:s', $oldtimestamp);

refer to http://php.net/manual/en/function.date.php

AsOne
  • 51
  • 1