Date & Time

Input Date & Time

Instead of numerical data, dates and times can also be passed to ChartData(). For example:

ChartData(1/1/2019 3/17/2019 3/18/2019 10/22/2019)

ChartData(1:00 8:32 14:01:38 23:22:11)

Combined dates and times (so-called timestamps) are also permitted. The date and time are joined together by an ampersand (&). For example:

Combined dates and times (so-called timestamps) are also permitted. The date and time are joined together by an ampersand (&). For example:

ChartData(2019-01-01&11:22 2019-03-22&18:33:00)

Periods (.), slashes (/) and hyphens (-) can be used to separate the date components entered. Colons (:) and apostrophes (') can be used to enter the times. Typographical apostrophes (‘’) are not allowed. For example:

ChartData(1.1.2019 4/13/2019 2019-05-22)

ChartData(0:22 11:22:33 3'13 14'05'22)

The 1st argument dateOrder of the function DateTimeOptions() can be used to predefine the order of day, month and year when entering the date. The following three orders are permitted:

Date orderConstantValueExample
year, month, dayymd12019-08-04
month, day, yearmdy2 (default)8/4/2019
day, month, yeardmy34.8.2019
It is important to always enter the DateTimeOptions() function BEFORE the ChartData() function.

To rule out ambiguities when entering the date, e.g. 8/4/19 (European: April 8, 2019 or American: August 4, 2019), the following rules should be followed:

  • Years should always include the century, e.g. 2019 and not 19. If the century is left out, then the two-digit year will automatically be turned into a four-digit year by xmCHART. The conversion can be carried out when the four-digit year, starting with the current year, lies either within the previous 70 years or within the next 30 years. For example, if the current year is 2019, then the years 00, 01, 02 to 49 will be turned into the years 2000, 2001, 2002 to 2049 and the years 50 to 99 into 1950 to 1999. If the current year is 2020, then the years 00, 01, 02 to 50 will be turned into the years 2000, 2001, 2002 to 2050 and the years 51 to 99 into 1951 to 1999.
  • If the date is entered in the order of day-month-year or month-day-year, then it is always advisable to specifically predefine the date order by using the function DateTimeOptions(). When using the order of year-month-day (recommended), it is not absolutely necessary as this order is clear — provided the year is entered with the century.

Examples:

ChartData(2019-02-01 2019-04-12) /* Year-month-day (Recommended) */

 

DateTimeOptions(dmy) /* European */

ChartData(1/2/2019 12/4/2019) /* Feb. 1, Apr. 12 */

 

DateTimeOptions(mdy) /* American */

ChartData(1/2/2019 12/4/2019) /* Jan. 2, Dec. 4 */

Output Date & Time

Format specifiers are to be placed between vertical bars | ... |. Leading and trailing texts can be attached as an option. The general structure is:

"[string] | specifiers | [string]"  ( Optional components in square brackets [ ... ] )

The following xmCHART functions support texts with date & time format specifiers:

For example:

AxisMajorTickLabelTexts(x;​"|M/D/YY|")

AxisMinorTickLabelTexts(x;​"|hh|h")

AxisMajorTickLabelTexts(x;​"Week: |WY|")

DateTimeOptions() has to be placed BEFORE functions containing text with date & time format specifier. For example:
 

DateTimeOptions(;​2) /* 2...Calendar week starts on Monday (ISO-8601). */

...

AxisMajorTickLabelTexts(x;​"Week: |WY|")

Specifier Constant Notes
Year specifiers YY Year without century
  YYYY Year with 4 digits
     
Quarter specifier Q Quarter of year (1..4)
  Qx Quarter with English ordinal suffix, not localized
  QX Quarter with English ordinal suffix, not localized, uppercase
     
Month specifiers M Month of year (1..12)
  MM Month of year with leading 0 (01..12)
  Mo 1st letter of localized month name, uppercase
  Mon Abbr. month name, localized
  MON Abbr. month name, localized, uppercase
  Month Month name, localized
  MONTH Month name, localized, uppercase
     
Week specifiers W Weekday index (Sunday=1, Monday=2, ...)
  WY Week of year (1..53). The starting day is defined by DateTimeOptions().
  WWY Week of year with leading 0 (01..53)
  WD1 1st letter of localized weekday name, uppercase
  Wd2 2-letter abbr. of localized weekday name
  WD2 2-letter abbr. of localized weekday name, uppercase
  Wd3 Abbr. weekday name, localized
  WD3 Abbr. weekday name, localized, uppercase
  Weekday Weekday name, localized
  WEEKDAY Weekday name, localized, uppercase
     
Day specifiers D Day of month (1..31)
  DD Day of month with leading 0 (01..31)
  DY Day of year (1..366)
  DDY Day of year with leading 0 (001..366)
  Dx Day with English ordinal suffix, not localized
  DX Day with English ordinal suffix, not localized, uppercase
     
Time specifiers h Hour in 24-hour format (0..23)
  hh Hour in 24-hour format with leading 0 (00..23)
  h12 Hour in 12-hour format (1..12)
  hh12 Hour in 12-hour format with leading 0 (01..12)
  m Minute (0..59)
  mm Minute with leading 0 (00..59)
  s Second (0..59)
  ss Second with leading 0 (00..59)
  ampm am or pm (in combination with h12 or hh12)
  AMPM AM or PM (in combination with h12 or hh12)
Example Format Result
7/31/2019 "|M/D/YY|" 7/31/19
  "|D.M.YYYY|" 31.7.2019
  "|YYYY-MM-DD|" 2019-07-31
  "|YYYYMMDD|" 20190731
  "|D Month YYYY|" 31 July 2019
  "|MON D, YYYY|" JUL 31, 2019
  "|Wd3, MONTH D|" Wed, JULY 31
8/25/2019 "Q|Q/YYYY|" Q3/2019
  "Week: |WY/YYYY|" Week: 35/2019 /* Calendar week starts on Sunday. */
  "W|WY: Weekday|" W34: Sunday /* Calendar week starts on Monday. */
  "|M/D (#DY)|" 8/25 (#237)
1:58:04 "|h:mm:ss|" 1:58:04
  "|hh:mm|" 01:58
  "Time: |h:mm:ss|" Time: 1:58:04
9:15:00 "|h12:mm AMPM|" 9:15 AM
14:05:32 "|h12:mm ampm|" 2:05 pm
Scroll to Top
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×