Maptitude GISDK Help

FormatDateTime()

Summary

Formats a DateTime compound variable.

 

Changes

Added to Version 2013.

 

Syntax

string = FormatDateTime(datetime value, string format_string)  

 

Argument Contents
value A DateTime compound variable
format_string A string containing a combination of the following standard system formats and/or specifiers

 

Standard System Format Description
@d Short date
@D Long date
@t Short time
@T Long time

 

Specifier Description
d The one- or two-digit day.
dd The two-digit day. Single-digit day values are preceded by a 0.
ddd The three-character day-of-week abbreviation.
dddd The full day-of-week name.
h The one- or two-digit hour in 12-hour format.
hh The two-digit hour in 12-hour format. Single digit values are preceded by a 0.
H The one- or two-digit hour in 24-hour format.
HH The two-digit hour in 24-hour format. Single digit values are preceded by a 0.
m The one- or two-digit minute.
mm The two-digit minute. Single digit values are preceded by a 0.
M The one- or two-digit month number.
MM The two-digit month number. Single digit values are preceded by a 0.
MMM The three-character month abbreviation.
MMMM The full month name.
s The one- or two-digit seconds.
ss The two-digit seconds. Single digit values are preceded by a 0.
t The one-letter A.M./P.M. abbreviation (e.g., A.M. is displayed as "A").
tt The two-letter A.M./P.M. abbreviation (e.g., A.M. is displayed as "AM").
y The one-digit year (e.g., 2001 is displayed as "1").
yy The last two digits of the year (e.g., 2001 is displayed as "01").
yyyy The full year (e.g., 2001 is displayed as "2001").

 

Returns

A string with a formated date and/or time.

 

Notes

Example

dt = CreateDateTime(3,1,2013,22,11,19,48)

ShowMessage(FormatDateTime(dt,))

ShowMessage(FormatDateTime(dt, "@DT"))

ShowMessage(FormatDateTime(dt,"dd MMM yyyy"))

ShowMessage(FormatDateTime(dt,"M/d/yy"))

ShowMessage(FormatDateTime(dt,"hh:mm:ss tt"))

ShowMessage(FormatDateTime(dt,"M/d/yy HH:mm:ss"))

 

See Also

Function Summary
CreateDate() Creates a DateTime compound variable with just a date
CreateDateTime() Creates a DateTime compound variable
CreateTime() Creates a DateTime compound variable with just a time
ParseDateTime() Parses a string to create a DateTime compound variable

 

 

©2025 Caliper Corporation www.caliper.com