| System Functions |
|
| Formats | 1. Julian from Numeric: JUL(year,month,day[,ERR=stmtref]) 2. Julian from Day Format: JUL(string$[,ERR=stmtref]) Where: |
|||
| year | Numeric expression of the year. Use 0 (zero) for the current year. If your value is less than 100, the current century is added to the value. | |||
| month | Numeric expression of the month. Use 0 for the current month. | |||
| day | ||||
| Numeric expression of the day of the month. Use 0 for the current day. string$ Program line number or statement label to which to transfer control. |
||||
| 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. |
|||
| Examples | The following example converts a given date to Julian format and calculates the difference from the current Julian date: 0010 INPUT "Enter Date (MM/DD/YY):",X$:"00/00/00" 0020 LET M=NUM(X$(1,2)) 0030 LET D=NUM(X$(3,2)) 0040 LET Y=NUM(X$(5,2)) 0050 LET N=JUL(Y,M,D,ERR=0100) 0060 PRINT "That is ",N-JUL(0,0,0)," days from now" 0070 STOP 0100 PRINT "Invalid date"; GOTO 0010 -:RUN Enter Date (MM/DD/YY):03/31/99 That is 23 days from now -: In the following example, the JUL( ) function accepts a valid DAY string and returns the corresponding Julian date: X$="01/01/A0" DAY_FORMAT "MM/DD/AA" PRINT JUL(X$) 10957 PRINT DTE(10957:"%Y %Ml %D") 2000 January 1 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 PVX is 1970, compatibility mode is 4714 BC) the day number changes; e.g., If 'BY'=1970, |
|||
| Sun=3, Mon=4, Tue=5, Wed=6, Thu=0, Fri=1, Sat=2 | ||||
| The weekend can be tested as follows: |
||||
| if ((jul(y,m,d)+3)|7)>=5 then <WEEKEND> | ||||
| If 'BY'=0, |
||||
| Sun=6, Mon=0, Tue=1, Wed=2, Thu=3, Fri=4, Sat=5 | ||||
| The weekend can be tested as follows: |
||||
| if (jul(y,m,d)|7)>=5 then <WEEKEND> | ||||