ITK Function Reference

(V10000.1.0.60_20160308.00)
Functions

Functions

FCLASSES_API int DATE_convert_format_date_to_date_t (const char *date, const char *format_str, date_t *date_structure)
 
FCLASSES_API int DATE_convert_formatted_string_to_date (const char *date, const char *format, logical localized_default_format, logical stringent_check, date_t *date_structure)
 
FCLASSES_API int DATE_convert_iso_date_to_date_t (const char *date_string, date_t *date_structure)
 
FCLASSES_API int DATE_date_to_string (date_t date_struct, const char *format_str, char **date_str)
 
FCLASSES_API int DATE_default_date_format (char **date_str)
 
FCLASSES_API int DATE_get_internal_date_string_format (char **format_str)
 
FCLASSES_API int DATE_string_to_date (const char *date_str, const char *format_str, int *month, int *day, int *year, int *hour, int *minute, int *second)
 
FCLASSES_API int DATE_string_to_date_t (char *date, logical *date_is_valid, date_t *the_dt)
 

Detailed Description

This section contains date utility functions. It describes a number of utility functions for creating, duplicating, and manipulating date.

Function Documentation

FCLASSES_API int DATE_convert_format_date_to_date_t ( const char *  date,
const char *  format_str,
date_t date_structure 
)

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:

// 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);
Parameters
date(I) Date in string format
format_str(I) Supplied date format
date_structure(O) The date_t structure
FCLASSES_API int DATE_convert_formatted_string_to_date ( const char *  date,
const char *  format,
logical  localized_default_format,
logical  stringent_check,
date_t date_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 format input format have found a match in the input string date, for the conversion to be considered successful.

  • If it is turned on and any parameter is missing, an error PROP_date_incomplete_conversion is returned, and the date_structure date is populated with the information that could have been extracted.
  • Otherwise, no error is reported even if the conversion is partial.
    Note that this is the case when passing a string "1999" and a format "%Y-%m-%d %H:%M": the ITK would then return ITK_ok and only the year (1999) is extracted in the output date_t structure.


If the parameter format is NULL or blank, the format used for the input string depends on the value for the parameter localized_default_format.

Returns
Parameters
date(I) Date in string format
format(I) Supplied date format
localized_default_format(I) Used in case the parameter format is invalid, to decide whether to use:
  • true: the localized date format as accessible through DATE_default_date_format,
  • false: the static format "%Y-%m-%d %H:%M:%S" (e.g. 1991-04-24 09:09:56).
stringent_check(I) Activates stringent check
date_structure(O) The converted date
FCLASSES_API int DATE_convert_iso_date_to_date_t ( const char *  date_string,
date_t date_structure 
)

Converts a string date to an ISO date_t structure. It assumes the format of the input string to be dd-mm-yyyy hh:mm:ss (e.g. 24-04-1991 09:09:56)

Returns
Parameters
date_string(I) date in string format
date_structure(O) ISO date
FCLASSES_API int DATE_date_to_string ( date_t  date_struct,
const char *  format_str,
char **  date_str 
)

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.

Parameters
date_struct(I) Supplied date_t structure
format_str(I) Desired date format
date_str(OF) Date in a textual representation
FCLASSES_API int DATE_default_date_format ( char **  date_str)

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
Parameters
date_str(OF) Date in a textual representation
FCLASSES_API int DATE_get_internal_date_string_format ( char **  format_str)

Retrieves the date format as a string.

The string format can be used in DATE_string_to_date for instance.

Returns
Parameters
format_str(OF) Date format
FCLASSES_API int DATE_string_to_date ( const char *  date_str,
const char *  format_str,
int *  month,
int *  day,
int *  year,
int *  hour,
int *  minute,
int *  second 
)

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.

Parameters
date_str(I) Specified date string
format_str(I) Format to describe how to interpret the date
month(O)
day(O)
year(O)
hour(O)
minute(O)
second(O)
FCLASSES_API int DATE_string_to_date_t ( char *  date,
logical date_is_valid,
date_t the_dt 
)

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
Parameters
date(I) date in string format
date_is_valid(O) is date valid or not
the_dt(O) date_t structure