/*============================================================================== Copyright (c) 2003-2005 UGS Corporation Unpublished - All Rights Reserved ==============================================================================*/ /** @file tc_date.h @brief Date utility functions This file contains the constants, data structures and function prototypes for working with the date utility. */ /* */ #ifndef TC_DATE_H #define TC_DATE_H #include #include #ifdef __cplusplus extern "C"{ #endif /** @defgroup DATE Date @ingroup TC This section contains date utility functions. It describes a number of utility functions for creating, duplicating, and manipulating date. @{ */ /** Unpicks a string containing a date and time into its components. The string must be formatted according the the template specified in the format_string argument; this template is the same as would be passed to the ANSI C strftime routine, except only the bB d H I mM S w yY conversions are implemented. Returns #PROP_invalid_date_format if unsuccessful. */ extern FCLASSES_API int DATE_string_to_date( const char* date_str, /**< (I) Specified date string */ const char* format_str, /**< (I) Format to describe how to interpret the date */ int* month, /**< (O) */ int* day, /**< (O) */ int* year, /**< (O) */ int* hour, /**< (O) */ int* minute, /**< (O) */ int* second /**< (O) */ ); /** Converts a date_t structure into a text representation. The date is formatted according to the specified format string. The format string is the one defined for the ANSI C strftime function except that the following conversions are not implemented: aA cC e h j n p rR tT uU V xX y Z % In other words, the following conversions are implemented: bB d H I mM S w yY Returns #PROP_invalid_date_format if unsuccessful. */ extern FCLASSES_API int DATE_date_to_string( date_t date_struct, /**< (I) Supplied date_t structure */ const char* format_str, /**< (I) Desired date format */ char** date_str /**< (OF) Date in a textual representation */ ); /** Converts a string date to a date_t structure. It assumes the format of the input string to be dd-mmw-yyyy hh:mm:ss (e.g. 24-Aug-1991 09:09:56) @returns */ extern FCLASSES_API int DATE_string_to_date_t( char* date, /**< (I) date in string format */ logical* date_is_valid , /**< (O) is date valid or not */ date_t* the_dt /**< (O) date_t structure */ ); /** Converts a string date to an ISO date_t structure. It assumes the format of the input string to be yyyy-mm-ddThh:mm:ss (e.g. 2018-03-02T19:33:59) @returns */ extern FCLASSES_API int DATE_convert_iso_date_to_date_t( const char* date_string, /**< (I) date in string format */ date_t* date_structure /**< (O) ISO date */ ); /** Retrieves the localized default date format, as specified by the entry "DefaultDateFormat" in the localization file.
If the value is not found, the date format is set to "%d-%b-%y %H:%M". @returns */ extern FCLASSES_API int DATE_default_date_format( char** date_str /**< (OF) Date in a textual representation */ ); /** Retrieves the date format as a string.

The string format can be used in #DATE_string_to_date for instance. @returns */ extern FCLASSES_API int DATE_get_internal_date_string_format( char** format_str /**< (OF) Date format*/ ); /** Converts a formatted string date to a #date_t structure.
If the input 'format_str' parameter is NULL or blank, the format of the input string needs to be in the format "yyyy-mm-dd hh:mm:ss" (e.g. 1991-04-24 09:09:56). @returns Please use #DATE_convert_formatted_string_to_date API instead, in the following fashion: @code // Using the same parameter as for DATE_convert_format_date_to_date_t DATE_convert_formatted_string_to_date(date, format_str, false, true, date_structure); @endcode */ extern FCLASSES_API int DATE_convert_format_date_to_date_t( const char* date, /**< (I) Date in string format */ const char* format_str, /**< (I) Supplied date format */ date_t* date_structure /**< (O) The #date_t structure */ ); /** Converts, possibly in a stringent manner, a formatted string date to a #date_t structure.
The stringent check enforces that all the parameters in the @p format input format have found a match in the input string @p date, for the conversion to be considered successful.
If the parameter @p format is NULL or blank, the format used for the input string depends on the value for the parameter @p localized_default_format. @returns */ extern FCLASSES_API int DATE_convert_formatted_string_to_date( const char* date, /**< (I) Date in string format */ const char* format, /**< (I) Supplied date format */ logical localized_default_format, /**< (I) Used in case the parameter @p format is invalid, to decide whether to use: */ logical stringent_check, /**< (I) Activates stringent check */ date_t* date_structure /**< (O) The converted date */ ); /** @} */ #ifdef __cplusplus } #endif #include #endif