Skip to main content
Version: v6.5.0

Convert-String-to-Time

Command Description​

Convert a string to time data

Command Prototype​

dTime = Time.CDate(sText, sFormat)

Parameter Description​

ParameterRequiredTypeDefaultDescription
sTextTruestring"12:00:00 January 1st, 2020"The string to be determined that whether it can be converted to time data
sFormatTruestring"yyyy.mm.dd.hh.mm.ss"In the time format , '.' stands for any non-numerical character

return​

dTime,The variable used to save the output of the command.

Demo​

Dim dTime 
dTime = Time.CDate("2022年2月9日 14:30:00", "yyyy.mm.dd.hh.mm.ss")
TracePrint(dTime)
/**
dTime = 44601.604166667
*/