[PocketQuery] Google Chart Api formatting all dates in Epoch...

I've tried using hAxis: {format: 'MM/d/y'} to force it to a more normal format, but it doesn't do anything at all...Is there anyway to force the format for a specific column in a pocketquery dataset that's been returned from the query, and then render the chart?

<!-- Template Contents -->


var options = { hAxis: {format: 'MM/d/y'} };

PocketQuery.chart('LineChart', options);


That just blatantly ignores the format change even though it should adjust accordingly...

3 answers

1 accepted

I analysed this a little further and found the source of the problem: we're serializing the result from the database to JSON using (FlexJSON) and then passing the JSON to Google Charts. FlexJSON serializes all date strings to epoch numbers and in Google Charts this number is displayed.

However, I also checked what would happen if FlexJSON didn't serialize the strings to numbers. If the strings stay in a default date format in the JSON string, Google Charts won't format the dates properly either.

I'm currently implementing a new feature in PocketQuery with which you'll be able to override the data that is given to the Google Charts API. With this feature, you can use a DateFormatter object and make the dates format as you desire. This will take some more time though and will be part of either PocketQuery 1.13 or 1.14. In the meantime, your workaround seems quite smart to me.

Thanks for the update. I'm still exploring what's possible with the Google Charts api through your addon so far things are working really well. I'll definitely be looking forward to the update.

Thanks for the feedback! If you like it, why not leave a little review on the Marketplace? :)

Hi Jason,

Sorry I read that post a little too late. I hope you're still interested in a reply ;). Can you please show me your SQL statement? The rendered table when you use the default template would be helpful too.


I ended up getting it to work by doing the following in the query itself. It would be nice to be able to format with hAxis properties, seems some work, while others do not.

CONVERT(nvarchar(10),dateadd(DAY,0,datediff(day,0,CreatedTime)), 101)

In both tables and charts that I have tried to just use the CreatedTime and then apply hAxis format string, it still renders the CreatedTime in epoch.

Suggest an answer

Log in or Join to answer
Community showcase
Louis De Jaeger
Posted Thursday in Off-topic

Friday fun: your best joke

Hi all Lets make this Friday fun really fun and post one (or more) of your best jokes! The joke can be about an Atlassian product, or just a really fun joke you want to share! I’m not the best j...

190 views 12 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot