☝️Small business or a startup? See if you qualify for our special offer.
+

datetime taken as string in imported file

Closed
Varun asked 2 days ago

Hi,

It seems that date field is being imported with time when we try to upload a csv . In our csv , it is set as d/MM/yyyy hh:mm:ss format. We would like to import this field as dd/MM/yyyy in date format into the pivot grid.

How can we achieve this result.

 

Thanks,

Varun

4 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster 1 day ago

Hello Varun,

Thank you for reaching out to us.

Please note that Flexmonster does not support the d/MM/yyyy hh:mm:ss input date format. The date should be in the yyyy-MM-dd'T'HH:mm:ss format.

If you are using Flexmonster Data Server, it only supports the ISO 8601 date format. For example:

    • "2021-04-25" - Date.
    • "2021-04-25T21:30:05" - Date and time.
    • "2021-04-25T21:30:05+03:00" - Date and time with a time zone.

When you load the data with the correct date format, you can set the type property of the Mapping object as "date string". Its default pattern string is "dd/MM/yyyy". Also, it can be configured using the datePattern property of the OptionsObject. You are welcome to check our documentation for more details: https://www.flexmonster.com/doc/date-and-time-formatting/#format-date-string.

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Varun 1 day ago

Hi Nadia,

 

Thanks for sharing the example. I tried to export xlsx using same method as explained on Using datePattern to change the default date format - JSFiddle - Code Playground

but it exported date field as string .

Could you please try to export xlsx by running script on Using datePattern to change the default date format - JSFiddle - Code Playground

, apply filter on date field in the excel sheet and see if you get it as date or string.

What we want, when we apply filter on date field in the excel, we should have year followed by month and day. I attached a screenshot for reference.

 

Thanks,

Varun

 

 

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster 2 hours ago

Hi Varun,

Thank you for the response.

We want to explain that the dates are only accessible in the Excel export for the flat view. Please refer to the following example: https://jsfiddle.net/flexmonster/8un4bye6/.

Dates in members on the pivot view are not intended to be formatted as dates in the Excel export. Since Flexmonster only exports the snapshot of the current grid state, data is not expected to be sorted or filtered in the exported file. Therefore, we recommend filtering the dates before export to Excel.

You are welcome to contact us if other questions arise.

Kind regards,
Nadia

Public
Varun 2 hours ago

Hi Nadia,

 

Thanks for the update! you can close this ticket.

This question is now closed