vba date to string
Dim myDate As Date, strDate As String
myDate = CDate("2021-01-28")
strDate = Format(myDate, "YYYY-MM-DD")
vba date to string
Dim myDate As Date, strDate As String
myDate = CDate("2021-01-28")
strDate = Format(myDate, "YYYY-MM-DD")
excel vba date to string conversion
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us