🍉 Meet Flexmonster Pivot Table & Charts 2.9.Check out all hot features!
Get Free Trial

Datetime formatting

Resolved
Jimmy asked on May 26, 2021

Hello,
 
I’m having some difficulties using “DateTime”, “Date string” and “Time”, hope you can help.
 
DateTime:
With formatting platter set to “yyyy-MM-ddThh:mm” to returns “2012-05-23P12:34”
Should return “2012-05-23T12:34”
 
Date string:
Returns “Invalid date” when no date is given.
Can this be changed to return blank like DateTime.
 
Time:
As there is no Timestamp object in JS I pass a date object to it “1899-12-30T12:25:33.123Z” this result I every Time cell saying “00:31:39” 
 
https://jsfiddle.net/ae03pkL4/ 
 
/Jimmy

2 answers

Public
Milena Pechura Milena Pechura Flexmonster May 27, 2021

Hello, Jimmy,
 
Thank you for your questions.
Please find our comments below.
 

  1. In the pattern you used, the letter T stands for AM/PM one-letter indicator, which shows the A or P letter on the grid.
    To achieve the desired behavior of the pattern, please enclose the T letter in quotation marks. The pattern should look like this: "yyyy-MM-dd'T'hh:mm"
    Please find further details about dateTimePattern here: https://www.flexmonster.com/doc/date-and-time-formatting/#!format-datetime.
  2. We would like to confirm that it is possible to change the "Invalid date" text. Please use the Flexmonster localization object:
    localization: {
    "grid": {
    "dateInvalidCaption": "(blank)"
    }
    }

    Here is an example for illustration: https://jsfiddle.net/flexmonster/8s5p204L/.
    We also recommend browsing related docs: https://www.flexmonster.com/doc/localizing-component/.

  3. The unexpected result you see on the grid was caused by the time format in your dataset.
    Please kindly note that the time passed to Flexmonster should be specified in seconds. For example:
    {
    "Time": 121
    }

    Here is a link to the corresponding section of the "Date and time formatting" article:
    https://www.flexmonster.com/doc/date-and-time-formatting/#!input-time-format.

Please let us know if our answer helped.
Looking forward to hearing from you.
 
Best regards,
Milena

Public
Jimmy May 28, 2021

Thanks for the answer, it helped.
 
/Jimmy

Please login or Register to Submit Answer