所以我受命将数据从MySQL DB
迁移到SQL DB
,我将表导出到CSV
,但是请注意{{1}中表中的日期}是MySQL
,我需要将它们转换为INT
格式。我执行TextToColumns来拆分列,然后要将其转换为日期格式,例如从Date
到正确的日期格式dd-MM-yyyy
我不知道该怎么做,怎么办?
编辑
我尝试过的事情:
这就是为什么我现在将表格逐一导出到CSV(右键单击表格,导出等)的原因
任何帮助将不胜感激。
谢谢!
答案 0 :(得分:0)
您具有UNIX时间戳记的值吗?
如果是:
根据{{3}}
Timestamp Converter
1446839632
Is equivalent to:
11/06/2015 @ 7:53pm (UTC)
2015-11-06T19:53:52+00:00 in ISO 8601
Fri, 06 Nov 2015 19:53:52 +0000 in RFC 822, 1036, 1123, 2822
Friday, 06-Nov-15 19:53:52 UTC in RFC 2822
2015-11-06T19:53:52+00:00 in RFC 3339
https://www.unixtimestamp.com/index.php
Option Explicit
Function ts2d(TimeStampValue As Long) As Date
ts2d = Convert_Timestamp_to_Date(TimeStampValue)
End Function
Function d2ts(DateVal As Date) As Long
d2ts = Convert_Date_to_Timestamp(DateVal)
End Function
Function Convert_Timestamp_to_Date(TimeStampValue As Long) As Date
Dim Date_1_1_1970 As Date
Dim Long_1_1_1970 As Long
Dim DaysCount As Date
Date_1_1_1970 = DateSerial(1970, 1, 1)
'Long_1_1_1970 = 25569
DaysCount = TimeStampValue / 86400
Convert_Timestamp_to_Date = DaysCount + Date_1_1_1970
End Function
Function Convert_Date_to_Timestamp(DateVal As Date) As Long
Dim Date_1_1_1970 As Date
Dim Long_1_1_1970 As Long
Dim DaysCount As Date
Date_1_1_1970 = DateSerial(1970, 1, 1)
'Long_1_1_1970 = 25569
DaysCount = DateVal - Date_1_1_1970
Convert_Date_to_Timestamp = CLng(DaysCount * 86400)
End Function
答案 1 :(得分:0)
FXD-我已要求您发布答案,但您尚未发布答案,因此我正在发布答案以帮助其他人更轻松地查看它,如果您看到此内容,请发布答案,我会纠正标记为您的答案:
=DATE(1970,1,1)+(1446839632/60/60/24)
1446839632可以替换为包含该值的单元格。