| System Functions |
|
| Formats | 1. Julian
from Numeric: JUL(year,month,day[,ERR=stmtref])
2. Julian from Day Format: JUL(string$[,ERR=stmtref])
|
||||||||||||||||||||
| Returns | Julian date (converted from year, month, day). | ||||||||||||||||||||
| Description | The JUL( ) function is used to convert a date from year, month, day to a Julian date. The Julian date is an integer: the number of days since the system base-date. By default, in ProvideX this is January 1, 1970. Use the 'BY' system parameter to change the base date. | ||||||||||||||||||||
| *Note* | Historically the true Julian calendar starts sometime around 4713 BC., but because of errors in early calendars, dates prior to 1200 are not reliable. If you want the JUL( ) function to return dates based roughly on the Julian calendar, set the 'BY' system parameter to 0 (zero). | ||||||||||||||||||||
| See Also | DAY_FORMAT Directive DAY System Variable DTE( ) Convert Date 'BY'= System Parameter 'JO'= System Parameter The 'JO' parameter is a +PxPlus Exclusive |
||||||||||||||||||||
| Examples | The
following example converts a given date to Julian format
and calculates the difference from the current Julian
date:
In the following example, the JUL( ) function accepts a valid DAY string and returns the corresponding Julian date:
JUL( ) can be used to determine if a given date is either Saturday or Sunday. Since the JUL( ) function returns a day number, JUL (...) | 7 would provide a week day number in the range 0-6. Depending on what is configured as the base year (standard for ProvideX is January 1st 1970, compatibility mode is 4714 BC) the day number changes. The system parameter of JO can also be used to adjust the Julian date for compatibility purposes with other languages. For example if the base year is set to the ProvideX standard of 1970 ('BY'=1970)
The weekend can be tested as follows:
However, if 'BY'=0, Sun=6, Mon=0, Tue=1, Wed=2, Thu=3, Fri=4, Sat=5 The weekend can be tested as follows:
|
||||||||||||||||||||
| *Note* | A simple technique to check for the weekend, regardless of the setting of the base year, is to subtract the JUL value from the JUL of a known date. For example January 1st 2000 was a Saturday thus MOD(JUL(m,d,y) - JUL(2000,1,1),7) will yield 0 or 1 for Saturday and Sunday respectively. | ||||||||||||||||||||