Reputation: 1053
Please help. My code just simple but show error as in the picture.
Msgbox DateTime.Now.ToString("yyyyMMdd HH:mm:ss")
Upvotes: 0
Views: 1670
Reputation: 38745
There is no DateTime object in VBScript, just plain Date variables and functions:
>> d = Date()
>> n = Now()
>> WScript.Echo TypeName(d), d, TypeName(n), n
>> WScript.Echo TypeName(Month(n)), Month(n)
>> s = FormatDateTime(n)
>> WScript.Echo TypeName(s), s
>>
Date 21.06.2017 Date 21.06.2017 05:58:13
Integer 6
String 21.06.2017 05:58:13
You can use a .NET System.Text.StringBuilder
to do more fancy formatting. (cf here)
Upvotes: 1