date_tojul()

Converts a date string into a Julian date

Call  
#include <vv_sys.h>
long date_tojul(date_stp, format_stp)

UCHAR *date_stp

Pointer to date string to convert

UCHAR *format_stp Pointer to date format string
Description of Parameters

format_stp: Specify SYSDATEFMT (the global system date format), US_DATE ("MM/DD/YY"), EURO_DATE ("DD/MM/YY"), or your own date format string. A date format string is composed of the following characters:

D Represents numeric day (i.e., 22). There can only be 2 Ds in the string.
M Represents numeric month (i.e., 12). There can only be 2 Ms in the string.
S Represents the string month (i.e., Mar or March depending on the number of Ss). There must be at least three Ss in the string so that the month can be uniquely specified.
Y Represents the numeric year. There can be 2 or 4 Ys in the string.
Any other character, including spaces, may be used as separators between the components. The separators are optional.
Returns
>= 0L The Julian date for the specified calendar date
1L The specified date string represents an invalid date
Description

Julian dates represent the number of days elapsed since a certain reference time in the past. The reference time from which all Julian dates are measured has been chosen by astronomers to be January 1, 4713 B.C.

The date string is parsed into its integer components (day, month, year) by calling date_tonums(). The Julian date is then calculated using these integer components.

If a day specifier (D) is not present in the format string, date_tojul() assumes the first day of the specified month.

If a month specifier (M or S) is not present in the format string, date_tojul() assumes the month is January. If a month string is specified, it must be unique. Therefore, "J" and "JU" are illegal, but "JUN" is accepted as June.

If a year specifier ('Y') is not present in the format string, date_tojul() assumes 1988. If only two Ys are present in the format string, date_tojul() calculates the century based upon the global variable CENTURYBREAK.

Related Functions

date_frjul(), date_tonums()

Cautions

Only dates on or after March 1, 0 A.D. will be converted correctly.

An invalid date (-1L return) is not considered a fatal error. VV_ERR does not get set; therefore, the VCS error reporting system does not report this condition.

The passed date must match the format string.


Home Contents Previous Next