Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7600177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:50:56+00:00 2026-05-30T22:50:56+00:00

I am using highcharts and cannot figure out what the date input should be

  • 0

I am using highcharts and cannot figure out what the date input should be from rails dates to the highcharts accepted format for dates.

In my migration file i am storing the date like this:

t.date :consumption_date

The value gets stored in this format “2012-03-25”, and going to the terminal and finding the record i get this:

=>  Sat, 31 Mar 2012

When the chart renders, the individual points display Invalid date. The following array gets output to highcharts to render

[[Sun, 25 Mar 2012, 1158], [Sat, 31 Mar 2012, 1200]]

The format that highcharts uses in one of their demo charts, when the data is submitted in jquery is of the form:

[[Date.UTC(1970,  9, 27), 0   ], [Date.UTC(1970, 10, 10), 0.6 ]]

How can i get rid of the invalid date, by submitting the correct date format to highcharts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:50:58+00:00Added an answer on May 30, 2026 at 10:50 pm

    Internally Highcharts uses javascript Date numbers (the number of milliseconds since Jan 1st 1970) to represent dates. See Mozilla reference.

    To get dates on an axis you will first need to set the axis type to ‘datetime’:

    xAxis: {
        type: 'datetime'
    }
    

    You have a few options when specifying the series data (all three examples produce the same chart):

    1. Setting a start point and using a fixed interval between points

      pointStart: Date.UTC(2012, 2, 6, 10),
      pointInterval: 1000 * 60 * 60,
      data: [5, 6, 4]
      
    2. Specifying the exact date using the Date.UTC method. This way its readable for humans:

      data: [
          [Date.UTC(2012, 2, 6, 10), 5], 
          [Date.UTC(2012, 2, 6, 11), 6], 
          [Date.UTC(2012, 2, 6, 12), 4]]
      
    3. Or specifying the epoch time directly:

      [[1331028000000, 5], [1331031600000, 6], [1331035200000, 4]]
      

    Example on jsfiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I'm using Highcharts to represent groups of time series. So, data points collected from
I'm working on a dashboard app using Rails 3.1.1/Highcharts with several graphs, but am
I've got this code I'm using to insert data into Highcharts def self.amount_on(date) where(date(created_at)
I am learning JS from scratch and implementing HighCharts code using JS. Seeing one
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I'm using highcharts for graphical showcase of statistics. As I understand it,highcharts uses UTC
I am using Highcharts plugin for my web site. So, I have a requirement
I have a big problem using highcharts, because I have been trying for hours
I have developed a webpage containing charts using HighCharts . It works fine on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.