Date as a string

Answered

Hi
 
I want to build a report (flat one) from JSON and one of the column is

“DateFrom”: “2019-02-28T22:00:00.000Z”,

 
In the fields I am getting DateFrom.Year,DateFrom.Month and DateFrom. Day – how to put complete date as a column in the report.
 
Thanks for help.
 
Regards
Ričardas
 

3 answers

WebDataRocks Team WebDataRocks May 11, 2020

Hi Ricardas,
 
Thank you for writing to us.
 
The default date format can be overridden by specifying the field type in the first object of the input JSON data:

...
dataSource: {
data: [
{
"DateFrom": {
type: "datetime"
}
},
...
//data here
...
]
}

You can find more info on this approach on the following documentation page: https://www.webdatarocks.com/doc/data-types-in-json/
 
Best regards,
WebDataRocks team

Ricardas Kunevicius May 20, 2020

Thanks for the reply. It helps. Is ip possible to change datetime format to yyyy-mm-dd?

WebDataRocks Team WebDataRocks May 29, 2020

Hello,
 
Thank you for your feedback.
 
Date formatting as achievable using the datePattern property for the date string data type and the dateTimePattern for the datetime data type.
 
Mentioned properties can be defined within the options object.
Detailed information about the options object in our documentation.
 
We hope it helps.
You are welcome to contact us in case additional questions appear.
 
Kind regards,
WebDataRocks Team