Question
· Aug 9, 2023

Display date in format DDMMYYYY

Hi,

Can anyone please help me to display date field in the format DDMMYYYY which I need single digit date needs to have leading 0 like 01022000.

I tried to-char but leading 0 is not there. 
 

I am writing object script with the help of sql query for generating extracts.

 

can anyone please help on this.

 

thanks

jude

Product version: IRIS 2020.1
Discussion (19)3
Log in or sign up to continue

Please see details on the yearopt parameter for $zdate (https://docs.intersystems.com/iris20232/csp/docbook/DocBook.UI.Page.cls?...) ... depending on the locale and on the year in question, if you don't specify yearopt you risk have a 2 digit year rather than a 4 digit year (default for my locale is yearopt = 0 which would show 20th century years as 2 digits).  You probably want to specify a yearopt of 4 to force 4 digits all the time.

What a night mare.

W $zd($h,15) =09/08/2023

w $zd($h,1)=08/09/2023

How do you know the which country the end user is in

08092023 is very bland

The Only international  standard is used by the air lines

Imagine a ticket with such a date 08092023 this would be fraught with mis understandoing

w $zd($h,2,,4) = 08 Aug 2023 this is recognised the whole world over

hdate=$zdh(%d,2)

however
set Date=$tr($zd(%d,1),"/","") or
set Date=$tr($zd(%d,15),"/","")

depending on your calendar

It's clearer now, this is the tricks of Excel, which convert the string 01022000 to the number 1022000.
In your case, try changing the cell type from General to Text.

PS: when generating Excel reports, I use the Date cell type (short format DD.MM.YYYY), and from Caché/IRIS I return the %Date type.
The components that I use already know how to translate the internal representation of the date 01.02.2000 from the Caché/IRIS format (58105) to Excel (36557) and vice versa.