0

My date time format is:

 POSIXct, format: "2018-11-05 12:09:12"

I want to send this data to Power BI for creating reports. But Power BI has the following data format:

"2018-11-05T12:59:06.856Z" -  which is a 'JavaScript built-in JSON object'

How do I convert my POSIXct date to the above JSON format? I have seen examples for converting date time to POSIXct and few other formatting rules, but not JSON.

Hackerds
  • 1,195
  • 2
  • 16
  • 34
  • So, is a 'JavaScript built-in JSON object' just a character string or something else internally? If the latter, what is it and can you (i) pass it from R or (ii) need to pass a character string and parse it in JavaScript? – Roland Nov 05 '18 at 14:55
  • @Roland It's some internal format (Power BI just had an example), from the link https://stackoverflow.com/questions/10286204/the-right-json-date-format, found that it was Javascript JSON format. – Hackerds Nov 05 '18 at 15:07
  • 2
    AFAIK JSON is simply text. So, you probably simply need to study `help("strptime")`. – Roland Nov 05 '18 at 15:16
  • 1
    This might also help: https://stackoverflow.com/questions/29517896/current-time-in-iso-8601-format – snaut Nov 05 '18 at 15:18

0 Answers0