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

  • Home
  • SEARCH
  • 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 7809011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:18:07+00:00 2026-06-02T03:18:07+00:00

I have a small dancer application which serves up some HTML (including the javascript

  • 0

I have a small dancer application which serves up some HTML (including the javascript to call the google charts API) and for other URLs queries a database and returns the data in encoded JSON in a form you can pass to google.visualization.DataTable. The javascript queries the dancer app for the JSON data then passes it into the google charts API – A simplified version is:

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">

      google.load('visualization', '1.0', {'packages':['corechart']});
      google.setOnLoadCallback(initialize);

function initialize() {
    var res = $.ajax({
        url: "/data/2",
        dataType:"json",
        async: false,
        data: "{}",
        contentType: "application/json",
        error: function(jqXHR, textStatus, errorThrown) {
             alert('textStatus ' + textStatus);
             alert('errorThrown ' + errorThrown);
        }
    });
    jsonData = res.responseText;
    var data = new google.visualization.DataTable(jsonData);

    var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
    chart.draw(data, {width: 400, height: 240});

}
    </script>

The problem is that some of the data returned by the Perl includes dates/timestamps and so should have the type set to “datetime”:

{"rows":[{"c":[{"v":"WHAT_CAN_I_PUT_HERE"},{"v":"2095"}]}],"cols":[{"type":"datetime","label":"DTU"},{"type":"number","label":"COUNT"}]}

In Javascript you could create a date to pass to the google charts API with:

new Date(2012, 1, 08, 09, 32, 0)

How can I send a date encoded in JSON from Perl such that the google charts API understands it? If you cannot what other options might be available to me?

  • 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-06-02T03:18:08+00:00Added an answer on June 2, 2026 at 3:18 am

    JSON does not support datetime as a data types. But according to Google’s documentation, you can just send a string with this format:

    JSON does not support JavaScript Date values (for example, “new Date(2008,1,28,0,31,26)”; the API implementation does. However, the API does now support a custom valid JSON representation of dates as a string in the following format: Date(year, month, day[,hour, minute, second[, millisecond]]) where everything after day is optional, and months are zero-based.

    Google Chart Tools Datasource Protocol

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

Sidebar

Related Questions

I have small database of business and their addresses. Using the Google Geocode API
I have small application, and I will have some external applications put data to
I have small chess application which consists of cells and boards. When user moves
I have small class called 'Call' and I need to store these calls into
I have small game engine written in c++. I'm considering using some features of
I have small page, it looks follows: Some header Label with text only for
I have small design question about html.DropDownListFor() How can I change width of html.DropDownListFor()
I have small function which will recolor pixels in a Bitmap from a given
I have small PHP script which has $query = SELECT MAX(id) FROM `dbs`; //query
I have a simple html dom or other scraping question. It could even work

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.