Zero Removal in Date-Time Formats

The components in date-time formats can be displayed using a number of options. For example, when a day number is less than 10, you can display it with zero suppression. Zero suppression replaces the zero with a blank space, leaving the remaining digit in the same position it occupied when the zero was displayed.

There are now zero removal options for month and day numbers. Zero removal eliminates the zero and moves the remaining portion of the field one position to the left.

The option for zero removal of a month number is the lowercase letter o. The option for zero removal of the day number is the lowercase letter e. Use of these options also requires a date separator. The N option to remove the separator is not supported with zero removal.

Using the o option for the month forces the day component to use the e option, even if d or D is specified for the day component in the format.


Top of page

Example: Using Zero Removal for Date-Time Month and Day Numbers

The following request creates the date-time value 01/01/2013. It then displays this value using:

DEFINE FILE GGSALES           
DATE1A/HMDYY = DT(01/01/2013);
DATE1B/HoeYY = DATE1A;        
DATE1C/HodYY = DATE1A;        
DATE1D/HMeYY = DATE1A;        
END                           
TABLE FILE GGSALES            
SUM DOLLARS NOPRINT           
DATE1A AS 'HMDYY'             
DATE1B AS 'HoeYY'             
DATE1C AS 'HodYY'             
DATE1D AS 'HMeYY'             
ON TABLE SET PAGE NOPAGE      
END                           

The output is:

HMDYY       HoeYY       HodYY       HMeYY    
-----       -----       -----       -----    
01/01/2013  1/1/2013    1/1/2013    01/1/2013

Top of page

Example: Comparing Zero Suppression With Zero Removal

The following request creates two dates with date-time formats in which the date component has a leading zero (01). In the first date, the day component is the first component and displays on the left. In the second date, the day component is the second component and displays in the middle. The request prints these dates:

DEFINE FILE GGSALES           
DATE1A/HDMYY = DT(01/12/2012);
DATE2A/HMDYY = DT(12/01/2012);
DATE1B/HdMYY = DATE1A;        
DATE2B/HMdYY = DATE2A;        
DATE1C/HeMYY = DATE1A;        
DATE2C/HMeYY = DATE2A;        
END                           
TABLE FILE GGSALES            
SUM DOLLARS NOPRINT           
DATE1A AS 'HDMYY'             
DATE2A AS ''      OVER        
DATE1B AS 'HdMYY'             
DATE2B AS ''      OVER        
DATE1C AS 'HeMYY'             
DATE2C AS ''                  
ON TABLE SET PAGE NOPAGE      

On the output, the first row shows the date with all zeros displayed. The second row shows zero suppression of the day number, where the zero has been replaced by a blank space so that all the components are aligned with the components on row 1. The last row shows zero removal, where the zero has been removed from the day number, and all of the remaining characters have been shifted over to the left:

HDMYY  01/12/2012    12/01/2012
HdMYY   1/12/2012    12/ 1/2012
HeMYY  1/12/2012     12/1/2012 

WebFOCUS