跳至内容

StrToTime

StrToTime

将格式为“yyyy.mm.dd hh:mi”的字符串转换为 datetime 类型(自1970年1月1日以来经过的秒数)。

datetime  StrToTime(
   string  value      // string
   );

参数

value

[in] 具有“yyyy.mm.dd hh:mi”格式的字符串。

返回值

自1970年1月1日以来经过的秒数,作为 datetime 类型的值。

示例:

datetime var1,var2,var3;
  var1=StrToTime("2003.8.12 17:35");
  var2=StrToTime("17:35");      // returns the current date with the given time
  var3=StrToTime("2003.8.12");  // returns the date with the midnight time of "00:00"

参见

PrintFormat(), TimeToStr(), TimeToString()

最后更新于