Google Visualization Datatable: DateFormatter is not working - google-visualization

I'm trying to show 12 hours format on Google Chart timeline.
This is the example from Google with arrayToDataTable method. It is working fine and this is the result I really want in 12hrs format with am & pm.
Code Pen link 1: http://codepen.io/Thein/pen/mAOrow
This is how I populated dataTable using google.visualization.DataTable().
Additionally, I formatted -
var formatter_12h = new google.visualization.DateFormat({ pattern: "d/MM/yy h:m:s aa" });
formatter_12h.format(dataTable, 1);
formatter_12h.format(dataTable, 2);
It always comes up with 24 hours format in tooltip.
Code Pen link 2: http://codepen.io/Thein/pen/KgNvJA
I tried to play with Culture value in in web.config as follow but it is still showing 24h format.
<globalization enableClientBasedCulture="false" uiCulture="en-AU" culture="en-AU" />
EDIT: It seems that Snippet 2 code is working with 12 hours format on
Apahache server and It is showing 24 hours format on IIS server.

Thanks to WhiteHat and his solution. I have fixed the Timeline chart as follow:
Code Pen link 3: http://codepen.io/Thein/pen/LRbdKv
HhAxis is quite messy though. It is so much cleaner in Code Pen link 1(http://codepen.io/Thein/pen/mAOrow). Please post your answer if you can get the result exactly like Code Pen link 1 with dataTable, I will accept your answer.

Related

iMacros formatting random numbers as currency, does not affect the same field each time

This has me stumped. Running a basic data input macro taking data from a CSV file. I have tried formatting the numbers as both general and numbers in excel. It seems to affect random fields - for example, on one run it will affect boxes 1, 3, and 7, and on run 2 it will affect boxes 2, 5, and 8.
For example, this is a line of code:
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:Zip CONTENT={{!COL1}}
In half of the boxes, the entry will be formatted as 58123, and the other half $58,123.00.
I believe this may be a bug related to the implementation of the firefox plugin I am using, as I just ran the code on the same form twice in a row. Same data, same page, no reloads or anything. It had the same issue both times, however the boxes it affected were different. Boxes that were formatted correctly the first time were formatted incorrectly the second, and vice versa. It may also be caused by the plugin being thrown off by boxes that format numbers as currency automatically, as the macro will just "paste" the value in the box without triggering the formatting script, so I would get results like this:
cost: 150
cost: $150
cost: 150
when all of them should read $150 and there is a JS currency formatting function applied to the box. The end result being that numbers that should be formatted as currency are not, and numbers that should not be formatted as currency are.
#chivracq
I slowed timing down to one event every 2s and it did not improve the issue. I am using iMacros 8.9.7 on firefox 47. Windows 10. iMacros FF v10 breaks support for several commands that I need, and Chrome has it's own particular issues with the sites I have to use. Unfortunately finance tends to be picky - surprised we got off of IE6, really. The first version of iMacros I purchased was v8 if I remember correctly, and most of the basic ideas/code were written back then and updated as needed. With iMacros being discontinued now I don't see a point in fixing the issues newer versions have - if I can't get this working I suppose I will have to learn a different automation framework.
My apologies for missing the wiki.
A snippet from my CSV would look like this:
12345678,1407 W Random St,Arlington,22205,800000,800000,10/10/2022,10/20/2022
I could snag some of their code from element inspector perhaps?

Display Date as Local Timzone, in AWS Quicksight (i have multiple timezones in 1 dataset)

I have referenced this thread in Stackoverflow
I have a dataset in Quicksight and it contains multiple timezones (Australia, India, Japan Korea).
i tested out one of the answers/solution (see below) and this works well. But this converts everything to Japan timezone.
parseDate(toString(formatDate({start_date},'MM-dd-yyyy HH:mm:ss','Asia/Tokyo')),'MM-dd-yyyy HH:mm:ss')
So I tried to incorporate ifelse into the Calculated Field option like below. But it showed error. I am also not sure where to click to understand where is the error. any one has experience with this, please advice, thanks!
ifelse(
{country}='Japan',
parseDate(toString(formatDate({start_date},'MM-dd-yyyy HH:mm:ss','Asia/Tokyo')),'MM-dd-yyyy HH:mm:ss'),
{country}='Korea',
parseDate(toString(formatDate({start_date},'MM-dd-yyyy HH:mm:ss','Asia/Seoul')),'MM-dd-yyyy HH:mm:ss'),
{country}='Australia',
parseDate(toString(formatDate({start_date},'MM-dd-yyyy HH:mm:ss','Australia/Melbourne')),'MM-dd-yyyy HH:mm:ss'),
{Start_date})

Unable to display Google Charts timeline on all devices

I'm using react-google-charts to create a Timeline. It works for me on my Macbook but not on iPad or iPhone with Chrome. It doesn't work in Safari or Firefox on the Macbook.
This is the error message I get:
undefined is not an object (evaluating 'Dygraph.TICK_PLACEMENT[a].datefield')×
I've looked through the Google Developers forum but couldn't find any similar posts. Any idea what this means?
GitHub repo
In the console in Safari, it says invalid date. So I need to fix the format of the dates I think.
I figured it out. It was the date format. The csv file I was pulling from used a date format '16JUL2016'. I was using that to create a new Date, i.e. new Date('16JUL2016'). That was not working in all browsers. So I used slice to get the month, date and year and create a new date.
let startDay = startDate.slice(0, 2);
let startMonth = months.findIndex((e) => e === startDate.slice(2, 5));
let startYear = startDate.slice(5);
let start = new Date(startYear, startMonth, startDay, 0, 0, 0);

Previous day in Postman request

I have below code in postman's pre-request script --which gives me current date. I rather want yesterday's date (current_timestamp - 1 day).
var current_timestamp = new Date();
postman.setEnvironmentVariable("current_timestamp", current_timestamp.toISOString());
I searched doc & net but could not get the answer. Can someone please help me with reference to date functions --to get my desired result.
Thanks
You can use the momentjs module in Postman to get a date in any format you need.
In the Pre-Request Script, add this to get what you need without using native JS:
var moment = require('moment')
pm.environment.set("current_timestamp", moment().toISOString())
pm.environment.set("current_timestamp - 1 day", moment().subtract(1, 'day').toISOString())
This snippet will bring in the module and set the dates you require in the environment file.
For a non moment solution in plain JavaScript to just quickly go back 24hrs, you could do something like this:
var yesterday = (Date.now() - 86400000) // 24hrs in ms
pm.environment.set('yesterday', new Date(yesterday).toISOString())
Both solutions would give you the same outcome but I prefer to use moment as it's a built-in module that handles dates and times very well.

Modify date time to a specific format

I'm having trouble coding a conversion to a specific time format along with converting to string format. I have the following code.
txtMonday->Text = Convert::ToString(dtpMondayIn->Value);
I want txtMonday(text box) not only to display dtpMondayIn's value(datetimepicker), but in h.mm format. Currently, it will display the date and time, for example, January 1, 2014 8:40:30 AM. I want the text box to show only 8.40 as in hours and minutes. How could I code this? I'm using Visual Studio 2012 and c++ language.
I am not really sure but
try this,
txtMonday->Text = Convert::ToString(dtpMondayIn->Value.ToString("hh:mm tt",CultureInfo.InvariantCulture));
OR
Convert::ToString(dtpMondayIn->Value.ToString("hh:mm",CultureInfo.InvariantCulture));
Also check DATETIME PICKER VALUE PROP
and DATETIME FORMATS
Let me know in case it works.