📜  vba 日期到字符串 - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:54.760000             🧑  作者: Mango

代码示例2
Excel formula to turn a date/time into text:

=TEXT(A1,"DD/MM/YYYY hh:mm:ss AM/PM")

'Reference:
'  https://support.office.com/en-us/article/text-function-20d5ac4d-7b94-49fd-bb38-93d29371225c

'---------------------------------------------------------------------------------------------

'VBA function to do the same thing:
Function DateToText$(dbl#)
    DateToText = Format(dbl, "DD/MM/YYYY hh:mm:ss AM/PM")
End Function