locked
Date Format in RESTful responses RRS feed

  • Question

  • Is there some reliable way to know what date format and timezone the server will use when it returns dates to RESTful queries? For example, you can query for the creation time of a job using:

    https://hpc-cluster/WindowsHPC/cluster_name/Job/573374?Properties=CreateTime

    It appears to be based off of some configuration on the server. Since some date formats are identical except with the month and day positions swapped, I would like to ensure that it is read correctly. Does the server send any information in the header or response to indicate what date format it used?

    Thanks,

     Nathan


    Friday, 20 March 2020 3:47 PM

Answers

  • Yes, there's an API for this:

    GET /WindowsHpc/Info/DateTimeFormat

    It will return something like

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">M/d/yyyy h:mm:ss tt</string>

    For the meaning of datetime strings like "M", "d", "yyyy" etc., please refer to https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

    Regards,

    Robert

    Monday, 30 March 2020 2:44 AM

All replies

  • Yes, there's an API for this:

    GET /WindowsHpc/Info/DateTimeFormat

    It will return something like

    <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">M/d/yyyy h:mm:ss tt</string>

    For the meaning of datetime strings like "M", "d", "yyyy" etc., please refer to https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

    Regards,

    Robert

    Monday, 30 March 2020 2:44 AM
  • Thank you! That is perfect.

    From experimenting on my server, it appears to return time in UTC. Can I assume that this will always be true?

    Monday, 30 March 2020 11:42 AM