System Functions
DTE( ) Convert Date
   
Formats
1. Convert Numeric Date: DTE(jul_date[,time][:fmt$][,ERR=stmtref])
2. Convert Date String: DTE(date$[:fmt$][,ERR=stmtref])

Where:

date$ Date string in the same format as the DAY_FORMAT (MM/DD/YY).
fmt$ Format of the date to be returned. If omitted, the default format is %Mz/%Dz/%Yz (date formatted as MM/DD/YY).
jul_date Julian date to convert. Numeric expression. If the value is zero, the current date is used. DTE(-1)returns a null ("") string if ‘BY'=0.
stmtref Program line number or statement label to which to transfer control.
time Time value containing hours and fractions of hours since midnight. Optional. Numeric expression. If you omit this, the current time is used.
   
Returns Formatted date (converted from Julian).
   
Description The DTE( ) function converts a date (and time) from Julian form to a formatted string. fmt$ defines the format to be returned, in which each component of the date is represented by percent sign (%) followed by a one- or two-letter code. The first letter indicates a source for the data (day, month, year etc.). The second character (if specified) indicates how to format the returned value. The chart below shows the results of the various format options:
% Char1 Source Format Default Char2 = l Char2 = s Char2 = z
%h Hour (12) 0-12 0-12 0-12 00-12
%m Minute 0-59 0-59 0-59 00-59
%p am or pm am,pm am,pm am,pm am,pm
%s Hour in seconds 0-59 0-59 0-59 00-59
%k Milliseconds 0-999 0-999 0-999 000-999
%A Year 00-99, A0-Z9 same same same
%D Day of month 1-31 Monday-Sunday Mon-Sun 01-31
%H Hour (24) 0-24 0-24 0-24 00-24
%J Day in year 1-365 1-365 1-365 01-99
%M Month in year 1-12 January-December Jan-Dec 01-12
%P AM or PM AM,PM AM,PM AM,PM AM,PM
%S Day in seconds 0-86399 0-86399 0-86399 00-99
%W Day of week 1-7 Monday-Sunday Mon-Sun 01-07
%Y Year 1970-9999 1970-9999 1970-9999 00-99
 

The %k value (milliseconds) is a +PxPlus Exclusive

 
In general, when the second character isl (lowercase L), the result is long text format an s indicates short text format. ProvideX maintains the exact contents of the text internally. The contents can be changed using a DEF DTE( ) directive. If the second letter is z,
  ProvideX supplies the value converted to a two digit value. ProvideX returns a 1-byte binary value if the second letter is p (for compatibility with other languages). The format can also contain YYYY, YY, MM, and DD (e.g., "YYYY/MM/DD") for current Long Year, Year, Month and Day values:
Char1 Source Format Default
DD Day of month 1-31
MM Month in year 1-12
YY Year 00-99
YYYY Year 1970-9999
   
If you include any other characters in the date format (e.g., punctuation: slashes, spaces, etc.) ProvideX copies them, as literals, to the output. To include a percent sign as a literal in the output, use %%in the format.
ProvideX includes the DTE("%A") format to deal with legacy application Y2K conversions (Version 4.10). The current year is returned using 00-99 for 1900 through 1999, A0-A9 for 2000 through 2009, B0-B9 for 2010 through 2019, etc. ProvideX supports fractional values in the DTE( ) function, using the DTE(fraction,*:"form") format.
   
Examples

PRINT DTE(0:"%Dl %Ml %D/%Y %hz:%mz %p")
Monday July 24/1995 10:27 pm

0010 PRINT 'CS',DTE(0:"%Dl %Ml %D/%Y"),@(70),
0010:DTE(0:"%hz:%mz %p")
0020 INPUT "Enter Date (MM/DD/YY):",X$:"00/00/00"
0030 LET M=NUM(X$(1,2))
0040 LET D=NUM(X$(3,2))
0050 LET Y=NUM(X$(5,2))
0060 LET N=JUL(Y,M,D,ERR=0100)
0070 PRINT "That is a ",DTE(N:"%Dl") ! Day value from N, in text, long form.
0080 STOP
0100 PRINT "Invalid date"; GOTO 0010
-:run
Saturday March 27/1999 03:32 pm
Enter Date (MM/DD/YY):03/31/99

That is a Wednesday

The DTE( ) function will support a valid DAY formatted string value; e.g.,

DAY_FORMAT "MM/DD/AA"
PRINT DTE("01/01/A0":"%Y %Ml %D")
2000 January 1
PRINT DTE("01/01/A0":"%Dz/%Mz/%Y")
01/01/2000

See Also DAY_FORMAT Directive,
DAY System Variable
JUL( ) Return Julian Date,
DEF CVS/DTE/LCS/UCS Directives.
'BY'= System Parameter