Previous Document Next Document
CorelScriptTools.FormatTime

Function FormatTime(Time As Date, Format As String) As String

Member of CorelScriptTools

Parameters
Description
Time
Specifies the time expression to convert to a string
Format
Specifies a code, as a string, representing the format of the time. Formats are created by using and combining the following (case-sensitive) codes:
h = Hours as 1-12 (12-hour clock)
hh = Hours as 01-12 (12-hour clock)
H = Hours as 0-23 (24-hour clock)
HH = Hours as 00-23 (24-hour clock)
m = Minutes as 0-59
mm = Minutes as 00-59
s = Seconds as 0-59
ss = Seconds as 00-59
t = AM/PM as A or P
tt = AM/PM as AM or PM
h:mm pm = Time as 4:36 pm

  • You can insert spaces and punctuation between time elements within the formatting string. See the example below.

In the following code example, the first line declares the date variable TodayDate. This variable is then assigned the current date and time with the GetCurrDate function. The StringTime variable is then assigned the current time using h:mm pm formatting.

DIM TimeNow AS DATE 
TimeNow = GETCURRDATE() 
StringTime = FORMATTIME (TimeNow, "HH:mm:ss tt") 
MESSAGE StringTime 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.