Skip to content

How to automatically adjust datetimes to daylight saving time? #5916

Answered by tonygermano
Coooz asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think other database engines are as good at this as postgres. It takes a little more code to script it using the java.time classes mentioned by @jonbartels mainly because you'll be calling multiple java classes, which can be a little verbose, but it is not that difficult and is way more powerful if you need extra functionality not provided by a db engine.

For example, one thing that I use it for is calculating the age of the patient at the date of service to place in a report header, and displaying it in months if < 2 years or years if >= 2 years (and it even easily handles edge cases involving leap years.)

This is what @pacmano1 's example would look like using java.time and hl7 …

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@pacmano1
Comment options

@jonbartels
Comment options

@Coooz
Comment options

@tonygermano
Comment options

Answer selected by Coooz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants