VBA对日期时间操作

1,把Double转换为时间
dim x as double
Dim y As Date
x=0.354166666666667
y = VBA.Format(x, "[$-en-US]h:mm AM/PM;@") 'y=#8:30:00 AM#

2,把三个整形数字合成时间
y = VBA.TimeSerial(8, 30, 0) 'y=#8:30:00 AM#

3,把三个整形数字合成日期
y== VBA.DateSerial(2020, 1, 4) 'y=#2020/1/4#

posted @ 2020-02-04 20:12  zhujie-  阅读(1667)  评论(0编辑  收藏  举报