Skip to content
Francisco Alcaraz edited this page May 23, 2023 · 2 revisions

Overview

The zif_date is a public interface that provides a series of methods for working with date values. This interface uses an internal type t_value of type xsddate_d for date representation.

Methods

VALUE

The VALUE method returns the value of the date object as is.

Return Value (r_value): The value of the date as is. The return value is of the type zif_date=>t_value.

VALID_VALUE_OR_ERROR

The VALID_VALUE_OR_ERROR method returns the value of the date if it's valid. If the date is not valid, it throws an error.

Return Value (r_valid_value): The value of the date if it's valid. The return value is of the type zif_date=>t_value.

Exception (zcx_date): This exception is thrown if the date is not valid.

VALID_VALUE_OR_FALLBACK

The VALID_VALUE_OR_FALLBACK method returns the value of the date if it's valid. If the date is not valid, a fallback value is returned, which may also be invalid.

Input Parameter (i_fallback): A fallback value of type zif_date=>t_value to be returned if the date is not valid.

Return Value (r_valid_value): The value of the date if it's valid, or the fallback value if the date is not valid. The return value is of the type zif_date=>t_value.

CHECK

The CHECK method throws an error if the date is not valid.

Return Value (r_self): A reference to the zif_date instance.

Exception (zcx_date): This exception is thrown if the date is not valid.

IS_VALID

The IS_VALID method checks if a date is valid.

Return Value (r_is_valid): A boolean value that returns true if the date is valid. The return value is of the type xsdboolean.

TO_FORMAT

The TO_FORMAT method returns a date in the specified format.

Input Parameter (i_format): The desired format of the date, of type zif_date_format.

Return Value (r_formatted_date): The date as a string in the specified format.

Exceptions (zcx_date, zcx_date_format): The zcx_date exception is thrown if the date is not valid and zcx_date_format if the specified format is not valid.

TO_FORMAT_DEFAULT

The TO_FORMAT_DEFAULT method returns a date in the default format. Each implementation may choose a different default format.

Return Value (r_formatted_date): The date as a string in the default format.

Exception (zcx_date): This exception is thrown if the date is not valid.

TO_FORMAT_ISO_8601

The TO_FORMAT_ISO_8601 method returns a date in the ISO 8601 format.

Return Value (r_formatted_date): The date as a string in the ISO 8601 format.

Exceptions (zcx_date, zcx_date_format): The zcx_date exception is thrown if the date is not valid and zcx_date_format if the format conversion fails.


See also: Date factory

Clone this wiki locally