Excel VBA:将日期字符串转换为Unix时间戳 [英] Excel VBA: Convert a date string to a Unix timestamp
本文介绍了Excel VBA:将日期字符串转换为Unix时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Excel VBA:如何转换日期字符串
2012-08-20到时间戳:1345438800
我需要存储1345438800单元格作为长数据类型值。
Excel VBA: How to convert date string
"2012-08-20" to timestamp: 1345438800
I need to store 1345438800 in cell as long data type value.
推荐答案
Public Function toUnix(dt) As Long
toUnix = DateDiff("s", "1/1/1970", dt)
End Function
这篇关于Excel VBA:将日期字符串转换为Unix时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文