Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
StringTools[FormatTime] - return a string containing a formatted date or time
Calling Sequence
FormatTime( fmt, option )
Parameters
fmt
-
(optional) string
option
(optional) integer offset or an equation of the form or of the form offset = integer[4]
Description
The FormatTime(fmt, option) command returns a string containing a formatted date and time. Both the format string fmt and the integer time displacement or equation option are optional. The default format is the ISO 8601 standard default date format, which has the form YYYY-MM-DD, where "Y" denotes a year digit, "M" denotes a digit of the month (01-12), and "D" denotes a digit of the day of the month (01-31). The default time displacement is (the current time).
The time format string is a Maple string that can contain time and date format conversion specifiers, introduced by a character. This works in a manner similar to the conversion specifiers used in printf or sscanf, but the defined conversion specifiers are different. The format string is copied to the output, but conversion specifiers are replaced with their meanings with respect to the option argument, if present, or the current date and time if no option argument is supplied. A literal character can be included in the format string by using .
The following table lists the known conversion specifiers and their meanings.
%%
the string "%".
%a
abbreviated weekday name.
%A
the full weekday name.
%b
abbreviated month name.
%B
full month name.
%c
a standard date and time representation.
%C
the century number (the year divided by 100 and truncated to an integer in the range 00 - 99).
%d
the two-digit day of the month number (01-31).
%D
the date in the form MM/DD/YY.
%e
the day of the month (1-31).
%H
the hour in a 24-hour clock (00-23).
%I
the hour in a 12-hour clock (01-12).
%j
day number (01 - 366).
%k
the hour in a 24-hour clock ( 0-23).
%l
the hour in a 12-hour clock ( 1-12).
%m
the month number (01 - 12).
%M
the minute after the hour (00-59).
%n
a newline character.
%p
a.m. or p.m.
%r
time representation for a 12-hour clock (using %p).
%R
the same as %H:%M.
%S
seconds after the minute (00 - 61).
%t
a tab character.
%T
same as %H:%M:%S.
%u
weekday as a decimal number (1-7; 1 = Monday).
%U
week number of the year (00 - 53); Sunday is the first day of week 1.
%V
The ISO 8601 week number (01 - 53).
%w
weekday (0-6); 0 = Sunday.
%x
a standard date representation.
%X
a standard time representation.
%y
year within the century (00 - 99).
%Y
year including the century (YYYY).
%Z
time zone name or abbreviation, if available.
Integer offsets passed via the second parameter must be 32-bit integers.
Examples
%% - % %a - Sat %A - Saturday %b - Mar %B - March %c - Sat Mar 03 22:20:43 2012 %C - 20 %d - 03 %D - 03/03/12 %e - 3 %H - 22 %I - 10 %j - 063 %k - 22 %l - 10 %m - 03 %M - 20 %p - PM %r - 10:20:43 PM %R - 22:20 %S - 43 %T - 22:20:43 %u - 6 %U - 09 %V - 09 %w - 6 %x - 03/03/12 %X - 22:20:43 %y - 12 %Y - 2012 %Z - EST
See Also
epoch, FormatMessage, printf, sscanf, string, StringTools, StringTools[ParseTime]
Download Help Document