Clojure UTC DateTime

When saving datetimes to databases like MySQL, it is best to save them as UTC instead of using your local timezone. That way, if your company, or IT department, or servers move to a new timezone, you won’t have to worry about adjusting every time stored in the database to match the new timezone. The trick is that you always return UTC times in your APIs, and then expect the clients or tools using your APIs to convert the provided UTC time to their local timezone for display.

This leads to a common question. How do I get the current datetime in UTC when using Clojure?

The formatted string with the UTC time will be yyyy-MM-dd hh:mm:ss.

Leave a Reply

Your email address will not be published.