Date/Time Formatting

Overview

In AnyChart If you have a keyword that returns a date/time value you can format it using this formatting postfixes. In the article below all parameters are listed with the usage explanation and sample syntax.

Formatting parameters

All formatting parameters for keyword are specified in a following way: {%KeywordName}{Param:value} or, if you need to specify several parameters: {%KeywordName}{Param1:Value1,Param2:Value2}, note that all keywords, parameters and parameter values are case-sensitive.

If you want to use these symbols ":", "{", "}" , "," in parameter format use "\:", "\{", "\}" , "\," instead.

By default all datetime keywords are formatted, to disable formatting use {%KeywordName}{enabled:False}

You can find samples of Date Time formatting in DateTime Axes Tutorial.

Setting maximum of visible characters

If the value (a number or a text) is to large, you may want to limit the number of characters using maxChar keyword. This parameters sets the maximal number of symbols, that are displayed. For example if the length of the string in {%Token} is greater than maxChar, then it will be trimmed and symbols set in maxCharFinalChars (by default "...") are shown at the end (this is done to show explicitly, that string is trimmed). If the number of characters in {%Token} is less than or equal to maxChar, then {%Token} is displayed as is.

If you don't want to show anything when value is trimmed - just set maxCharFinalChars to nothing.

Sample setting maximum of visible characters to 5 and no final characters:

XML Syntax
Plain code
01 <text><![CDATA[{%Value}{maxChar:5,maxCharFinalChars:}]]></text>

to top

Formatting Parameters List

Format specifier Description
%d Displays the current day of the month, measured as a number between 1 and 31, inclusive. If the day is a single digit only (1-9), then it is displayed as a single digit.
%dd Displays the current day of the month, measured as a number between 1 and 31, inclusive. If the day is a single digit only (1-9), it is formatted with a preceding 0 (01-09).
%ddd The abbreviated name of the day of the week, as defined in AbbreviatedDayNames.
%dddd The full name of the day of the week, as defined in DayNames.
%M Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is displayed as a single digit.
%MM Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is formatted with a preceding 0 (01-09).
%MMM The abbreviated name of the month, as defined in AbbreviatedMonthNames.
%MMMM The full name of the month, as defined in MonthNames.
%y Displays the year as a maximum two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is displayed as a single digit.
%yy Displays the year as a maximum two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is formatted with a preceding 0 (01-09).
%yyyy Displays the year, including the century. If the year is less than four digits in length, then preceding zeros are appended as necessary to make the displayed year four digits long.
%h Displays the hour in the range 1-12. The hour represents whole hours passed since either midnight (displayed as 12) or noon (also displayed as 12). If the hour is a single digit (1-9), it is displayed as a single digit. No rounding occurs when displaying the hour.
%hh Displays the hour in the range 1-12. The hour represents whole hours passed since either midnight (displayed as 12) or noon (also displayed as 12). If the hour is a single digit (1-9), it is formatted with a preceding 0 (01-09).
%H Displays the hour in the range 0-23. The hour represents whole hours passed since midnight (displayed as 0). If the hour is a single digit (0-9), it is displayed as a single digit.
%HH Displays the hour in the range 0-23. The hour represents whole hours passed since midnight (displayed as 0). If the hour is a single digit (0-9), it is formatted with a preceding 0 (01-09).
%m Displays the minute in the range 0-59. The minute represents whole minutes passed since the last hour. If the minute is a single digit (0-9), it is displayed as a single digit.
%mm Displays the minute in the range 0-59. The minute represents whole minutes passed since the last hour. If the minute is a single digit (0-9), it is formatted with a preceding 0 (01-09).
%s Displays the seconds in the range 0-59. The second represents whole seconds passed since the last minute. If the second is a single digit (0-9), it is displayed as a single digit only.
%ss Displays the seconds in the range 0-59. The second represents whole seconds passed since the last minute. If the second is a single digit (0-9), it is formatted with a preceding 0 (01-09).
%t Short am/pm name. Can be changed in localization settings.
%tt The first character in the AM/PM designator. Can be changed in localization settings.
%z Displays the time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading sign (zero is displayed as "+0"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is displayed as a single digit with the appropriate leading sign. The setting for the time zone is specified as +X or –X where X is the offset in hours from GMT. The displayed offset is affected by daylight savings time.
%zz Displays the time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading or trailing sign (zero is displayed as "+00"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign. The setting for the time zone is specified as +X or –X where X is the offset in hours from GMT. The displayed offset is affected by daylight savings time.
%zzz Displays the time zone offset for the system's current time zone in hours and minutes. The offset is always displayed with a leading or trailing sign (zero is displayed as "+00:00"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12:00 to +13:00. If the offset is a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign. The setting for the time zone is specified as +X or –X where X is the offset in hours from GMT. The displayed offset is affected by daylight savings time.

 

to top