![]() |
![]() |
7 |
![]() |
The LA Fox Developer Newsletter
December 1997
Returning a Character Date in
any Format Specified
by Leslie Stevens of Edmonton, Alberta Canada.
EXAMPLE:
cDate
(
‘DDD.’, {12/09/1996})
will giveyou: Thu.
PROGRAM:
CDATE
AUTHORS:
Joe Friedel and Leslie Stevens.
WRITTEN:
September 12, 1996.
REMARKS:
This program will return a character date in any format
that you specify.
FORMAT:
cDate
(
(cMask,] (dDate]
where: dDate is the “Date” that you want converted
(the default is date0).
Mask is the character mask for converting the date
(the default is the dtoc() function).
Mask characters that wU! ba converted are;
Mask Returns
"YYYY" 4 character year
last 2 characters of the year
“MMMM” month name
“MMM” first 3 characters of month name
month number
day of the week
“DDD” first 3 characters of day of week
‘DD” day number
EXAMPLE:
cDate (“DDDD, MMMM DD, "YYYY", (12/09/1996)
will give you: Thursday, September 12, 1996
EXAMPLE:
cDate
(
"MMM.DD/YY", (12/09/1996))
will give you: Sep.12/96
FUNCTION cdate
LPARAMETERS cMask, dDate
if parameters()
=
0
return dtoc(dateO)
endif
if parameters()
=
I
if type(’cMask’)
=
dDate
=
cMask
cMask
=
return dtoc(dDate)
else
dDate
=
date()
endif
endif
if empty(dDate)
return
endif
if type(’cMask’)
<>
‘C’
clear typeahead
=messagebox(”Invalid parameter (#1 cMask) passed to CDATE
function!”,16,”Programmer Error”)
return
endif
if type(’dDate’)
<>
‘D’
clear typeahead
=messagebox(”Invalid parameter (#2 dDate) passed to CDATE
function!",16,"Programmer Error”)
return
endif
cMask
=
upper(cMask)
cMask
=
strtran(cMask,”YYYY”,ltrim(str(year(dDate))))
cMask
=
(strtran(cMask,"YY",padl(ltrim(right(str(year(dDate)),2)),2,'0'))
*
OR: cMask
=
strtran(cMask,”YY”,right(str(year(dDate)),2))
cMask
=
strtran(cMask,”MMMM”,cmonth(dDate))
cMask
=
strtran(cMask,”MMM”,left(cmonth(dDate),3))
cMask
=
strtran(cMask,”MM”,padl(ltrim(str(month(dDate),2)),2,’O’))
*
OR: cMask
=
strtran(cMask,”MM”,ltrim(str(month(dDate),2)))
cMask
=
strtran(cMask,”DDDD”,cdow(dDate))
cMask
=
strtran(cMask,”DDD”,left(cdow(dDate),3))
cMask
=
strtran(cMask,”DD’,padl(ltrim(str(day(doate),2)),2,’O’))
*
OR: cMask
=
strtran(cMask,”DD”,Itrim(str(day(doate),2)))
RETURN cMask
Universal Thread Navigator
If you are a member of The Universal Thread, you might want to
check out a new online/offline reader that was released on 10/
07. It offers many features which will
enhance your productivity, allowing you to process unread
messages offline.
This is particularily of benefit
if
you access the ‘net on an hourly
basis. See the Universal Thread Navigator link from the Univer-
sal Thread main page in order to get all the
details about it. The Universal Thread can be accessed at
universalthread.com.
Page 7
|
![]() |
![]() |
7 |
![]() |