I'm looking into using the Shared With Details column for something and I don't understand some of the values. I see the user and then a DateTime value, which would be amazing if it referred to the date of the share, but it's just a long string of numbers that does not seem to reflect any date. For ex this is what it looks like when I shared a document today:


Any clarity on the DateTime meaning/format?


Since Date in JavaScript has no representation in JSON, multiple formats exists to represent a Date when using JSON. The Date(xxx)-Version is Microsoft special...

If you want to use the value in JavaScript, simply extract the numbers and initialize a Date using the number. From the example above:

var d = new Date();

will give you the Date in question. See also https://stackoverflow.com/questions/1016847/converting-net-datetime-to-json and https://stackoverflow.com/questions/206384/how-do-i-format-a-microsoft-json-date

However, to parse the value from a Flow - this is not so trivial.

  1. I started out by defining a "demo" json: demo-json
  2. define a variable of type object to contain the parsed json object
  3. define a variable of type string to contain the date-string date-string
  4. define a variable of type integer to contain the length of the numers in the date-string len of numbers the value of the expression is sub(length(variables('extractedProperty')), 8) - the 8 is due to the 6 charaters in front (/Date() plus the last two ()/).
  5. define a variable of type integer to contain the value of the number (i.e. the milliseconds since Jan. 1st 1970) parsed numbers the value of the expression is int(substring(variables('extractedProperty'), 6, variables('lenOfNumbers')))
  6. define a variable of type string to hold the result the result the value of the expression is addSeconds('1970-01-01T00:00:00Z', div(variables('onlyTheNumber'),1000), 'o').

The result is a string that can be used as a timestamp in following actions. Notice that it is not exact, since the number in the json is milliseconds and flow accepts only full seconds. (Taking your example from above, the result will be off by 28 milliseconds...)

| improve this answer | |
  • Thanks so much Nils, I've never used JSON, and I'm trying to use this date value in a Flow. I managed to use a couple Compose actions to get just the date string, but I'm not sure how to use your suggestion above in a Parse JSON action. Could you give me the whole code? – Sylvie May 14 '19 at 11:39
  • I added a rough idea on how to do this in flow - there is probably a much better way... – Nils May 14 '19 at 21:11
  • If you feel the answer helped, feel free to mark it as such. – Nils May 29 '19 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.