Date and Time Format Specifiers

Date Time Specifiers

Date and time format specifiers for custom date and time output.

Specifier Description
d Day number, no leading zero
dd Day number, with leading zero
ddd 3-character day name
dddd Full day name
D Weekday number. 1 stands for Monday, and 7 stands for Sunday,
M Month number, no leading zero
MM Month number, leading zero
MMM 3-character month name
MMMM Full month name
q Quarter number in a year
yy 2-character year (Input < 45 interpreted as 20yy)
yyyy 4-character year
h Hour, no leading zero (12 hour time)
hh Hour, with leading zero (12 hour time)
H Hour, no leading zero (24 hour time)
HH Hour, leading zero (24 hour time)
m Minute, no leading zero
mm Minute, with leading zero
s Second, no leading zero
ss Second, with leading zero
# Fractional seconds (each # is one decimal place)
t Displays A or P (for AM and PM)
tt Displays AM or PM

Note: By default, dates and times in Origin are stored internally as as an adjusted Julian-day value. In this system, Origin will display seconds to six decimal digits but the precision is limited to 0.0001 seconds when rounded at the fourth decimal digit. Starting with Origin 2019, Origin supports an optional 2018 date-time system in which "time zero" is defined as January 1, 2018 00:00. Assuming contemporary date-time measurements, this system affords much better resolution of the time portion of date-time data (up to 8 decimal digits).

Example

newbook;
col(1)[1] = @D;
wks.col1.setformat(4,22,dddd', 'MMMM' 'dd', 'yyyy' 'hh':'mm' 'tt); // Shows today's date
wks.col1.width = 24;
col(2)[1]=col(1)[1];
wks.col2.setformat(4,22,yyyy'Q'q);