Comparing Dates
Hi,
Any suggestion on how to compare dates? Below is my code but it does not seem to work.
USER>w $zdate(zdateh(x,8),1) > $zdate($zdateh(y,8),1)
When I set x to "06/01/2022" and set y to "04/01/2022" gives me an output of 1
When I set x to "09/01/2019" and set y to "04/1/2022" still gives me an output of 1
Any help is appreciated.
Thanks!
Product version: IRIS 2020.2
$ZV: HealthShare 2020.2 [HealthShare Modules: Core:20.1.8624 + Patient Index:20.0.8624] - IRIS for UNIX (IBM AIX for System Power System-64) 2020.1 (Build 217_1_20418U) Mon Dec 21 2020 12:09:33 EST
Hi.
Just compare
w zdateh(x,8) > $zdateh(y,8)
Regards,
Matjaž
It worked! Thank you so much.
What happens if you try this?
This worked as well! Thank you for your input!
Which format do you use - DD/MM/YYYY?
Be carefull : the second parameter of $zdateh is =1 for US format (mm/dd/yyyy), =4 for European format (dd/mm/yyyy) and =8 for yyyymmdd format.
Luckily, $zdateh is smart enough to know your date is really US and not yyymmdd, but the correct answer is to use $zdateh(x,1) > $zdateh(y,1), and not 8 as second parameter :
Gotcha! that's really helpful. Appreciate the input. Thank you!
Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue