3

If I have a date output with multiple time zones such as this which I'm using for an events page:

Oct 30, 2021 - 07:00 AM AEDT, Oct 29, 2021 - 21:00 PM BST, 15:00 PM CDT, 16:00 PM EDT

Is there a preferred way to declare a datetime attribute for this string?

Examples:

Just the first datetime entry

<time datetime="2021-10-30 07:00:00 AEDT" >Oct 30, 2021 - 07:00 AM AEDT, Oct 29, 2021 - 21:00 PM BST, 15:00 PM CDT, 16:00 PM EDT</time>

Every datetime entry

<time datetime="2021-10-30 07:00:00 AEDT" >Oct 30, 2021 - 07:00 AM AEDT</time>, <time datetime="2021-10-29 21:00:00 BST" >Oct 29, 2021 - 21:00 PM BST</time>, <time datetime="2021-10-29 15:00:00 CDT" >15:00 PM CDT</time>, <time datetime="2021-10-29 16:00:00 EDT" >16:00 PM EDT</time>

Or as I'm dealing with multiple time zones just show UTC

<time datetime="2021-10-29 20:00:00 UTC" >Oct 30, 2021 - 07:00 AM AEDT, Oct 29, 2021 - 21:00 PM BST, 15:00 PM CDT, 16:00 PM EDT</time>

Is any of the above treatments acceptable, or is there an alternative approach?

Thanks

1 Answer 1

3

Any of your examples would be valid.

Because you are displaying a single date/time for various time zones, I would suggest not using separate <time> tags for each time zone. They are redundant and they take up extra bytes.

I like your idea of using UTC for the datetime rather than the first timezone. UTC is the time zone that computers are pretty much 100% guaranteed to understand, so it seems most appropriate for the machine readable version.

1
  • Thanks - I agree with you on the idea of using UTC, I think it's the cleanest solution. I've run with that Commented Oct 7, 2021 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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