Question
· 13 hr ago

Display date format in DD-MM-YYYY

Hello my friends,

I have a bit problem with date format, I need to display like this DD-MM-YYYY

I've put the objectscript like this : set DOB=$zd(paper.PAPERDob,15)  

and the result is 

Why It cannot show the full year, I mean why 99 or 95 why not 1999 or 1995 ? 

Thank You

Best Regards,

Steven Henry

Product version: IRIS 2025.1
$ZV: IRIS for UNIX (Red Hat Enterprise Linux 8 for x86-64) 2023.1.1 (Build 380_0_23762U) Fri Oct 18 2024 17:32:14 EDT [Health:5.1.0-1.m1]
Discussion (5)3
Log in or sign up to continue

The code you used (set DOB=$zd(paper.PAPERDob,15)) most likely returns a two-digit year by default because $ZDATE defaults to using two-digit years for certain ranges unless a different option is explicitly set. For years like 1995 or 1999, $ZDATE shows the last two digits as 95 or 99. To display the full year, use the YearOpt parameter.

You can modify the code to explicitly specify four-digit years. Use the YearOpt argument in $ZDATE. The following example forces four-digit years:

set DOB=$ZDATE(paper.PAPERDob,15,,,4)
  • $ZDATE(hdate,dformat,monthlist,YearOpt) allows you to specify YearOpt, where:
    • 4 ensures the year is displayed as four digits.
  • Format code 15 corresponds to DD/MM/YYYY [1].

If your issue persists, ensure your locale settings align correctly with four-digit years expected in the display [1].

Sources: