Navigation:  thinBasic Modules > DT (Date Handling) >

DT_TimeFormat

Previous pageReturn to chapter overviewNext page

 

Description

 

Formats a time string according on a given time mask

 

Syntax

 

st = DT_TimeFormat(sTime, sFormat [, fOptions])

 

Returns

 

String.

Returns a time string as request.

 

Parameters

 

Name

Type

Optional

Meaning

sTime

String

No

The date string, if empty the function will use the current time, but always return a native time string (ignore the sFormat parameter)

sFormat

String

No

Specify the format to assign to the time string, use the following elements to construct a format mask string:

Mask        Description

h        Hours with no leading zero for single-digit hours; 12-hour clock.

hh        Hours with leading zero for single-digit hours; 12-hour clock.

H        Hours with no leading zero for single-digit hours; 24-hour clock.

HH        Hours with leading zero for single-digit hours; 24-hour clock.

m        Minutes with no leading zero for single-digit minutes.

mm        Minutes with leading zero for single-digit minutes.

s        Seconds with no leading zero for single-digit seconds.

ss        Seconds with leading zero for single-digit seconds.

t        One character time-marker string, such as A or P.

tt        Multicharacter time-marker string, such as AM or PM.

fOptions

Numeric

Yes

One or more (using OR) of the following equates:

%DT_NOMINUTESORSECONDS

%DT_NOSECONDS

%DT_NOTIMEMARKER

%DT_FORCE24HOURFORMAT

 

 

Remarks

 

If you use spaces to separate the elements in the format string, these spaces will appear in the same location in the output string. The letters must be in uppercase or lowercase as shown in the table (for example, "tt" not "TT"). Characters in the format string that are enclosed in single quotation marks will appear in the same location and unchanged in the output string.

 

Restrictions

 

See also

 

Examples

 

MSGBOX 0, DT_TimeFormat("18:19:20""'HH'.'mm'.'ss'"' results '18.19.20'

 

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com