Back to amCharts.com

Date formats

Data date format

In your data set settings, you must define date format of your data. It must be set in:

<data_sets>
   <data_set>
      <csv>
         <date_format>YYYY-MM-DD</date_format>

Date format is described using the following tags:

  • YYYY - year
  • MM - month
  • DD - day
  • hh - hour
  • mm - minutes
  • ss - seconds

Here is the table with several date format examples and how they should be described:

2008/12/31YYYY/MM/DD
15:04 23-06-2008hh:mm DD-MM-YYYY
01-11-2007DD-MM-YYYY
2008-01-31 16:32:57YYYY-MM-DD hh:mm:ss

Important:

  • you must use 24 hours time format
  • zeros must be added before months, days, hours, minutes and seconds from one number (02, 05, etc)
  • you can not use short version of year, the "YY" will not work.

Date format in the legend and on the x axis

You can define how the dates should look like on the x axis and in the legend in the following section of the settings:

<date_formats>        
   <x_axis>     
     <seconds></seconds>
     <minutes></minutes>
     <hours></hours>
     <days></days>
     <months></months>
     <years></years>
   </x_axis>
   <legend>
     <seconds></seconds>
     <minutes></minutes>
     <hours></hours>
     <days>month DD, YYYY</days>
     <weeks></weeks>
     <months></months>
     <years></years>
   </legend>
</date_formats>  

Date format for the legend and x axis is described using the following tags:

  • YYYY - year
  • MM - month
  • month - the name of the month
  • WW - the name of a week day
  • DD - day
  • hh - hour
  • mm - minutes
  • ss - seconds

"month" and "week" will be replaced with the strings which can be set in <strings> section.

As you noticed, you can set different date format for different time periods. For example, let's say you have daily data. When the selected period on the chart is small (several days), the chart will use date format defined in <days></days>. If you expand the selection, the chart will switch the date format to <weeks>, then to <months> and then to <years>. If you want to use one date format no matter what what time period is selected, simply set the same date format for all the available periods.

Back to top