Previous Document Next Document

Object Model Reference : Classes : C : CorelScriptTools : Methods : CorelScriptTools.FormatTime


CorelScriptTools.FormatTime

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

Description

Member of CorelScriptTools

Parameter
Description
Time
Specifies the time expression to convert to a string
Format
Specifies the 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 through 12 (12-hour clock)
hh = hours as 01 through 12 (12-hour clock)
H = hours as 0 through 23 (24-hour clock)
HH = hours as 00 through 23 (24-hour clock)
m = minutes as 0 through 59
mm = minutes as 00 through 59
s = seconds as 0 through 59
ss = seconds as 00 through 59
t = AM/PM as A or P
tt = AM/PM as AM or PM
h:mm pm = time as in the following example: 4:36 pm

 
You can insert spaces and punctuation between time elements within the formatting string. See the example that follows.
Example

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 2013 Corel Corporation. All rights reserved.