UDF Date Extensions for Magic RAD software
Version 0.2
Copyright © 1999 Andreas Sedlmeier
Contact: sedlmeier@hotmail.com
MGDATUTL Magic Date Utilities
UDF Date Extensions for Magic RAD software

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.


Alphabetical list of functions
Function short decription
duBusinessToStd Business date (Year, Week, Day of Week) to Standard (Year, Month, Day of Month)
duCalendar returns an Alpha String with a simple Calendar for the given year and month
duDayDiff calculates the difference between two dates in number of days
duDOW returns the number of the day of week
duDOY returns the number of the day (Day Of Year) of the given date 
duEasterSunday returns the date of Easter Sunday
duIsBusinessDate checks if a given date is valid a business date
duFDW returns the date of the first day of a given week (the monday)
duIsDate checks if a given date is valid
duIsLeapYear checks if a given year is a leap year
duLocalTime returns an alpha string with the local time (and DST information)
duRepeatWOM does calculations like 2nd Sunday in December 1999
duStdToBusiness Standard date (Year, Month, Day of Month) to Business date (Year, Week, Day of Week)
duTimeDiff calculates time difference
duWeek returns the calendar week
duWIY returns the number of weeks in a given year
duWOY returns the number of the week and the year
not yet implemented ...
Function short decription
duRFC1123 returns a date/time stamp as specified in RFC 1123 and used e.g. in HTTP/1.1

 

For your convenience, I added Magic's Date and Time functions to this document, also:
Function short decription
ADDDATE Performs calculation on a date variable
ADDTIME Performs calculation on a time variable
BOM Beginning of month of a given date
BOY Beginning of year
CDOW Character Day of Week
CMONTH Character Month
DATE Returns the system date
DAY Day of Month
DOW Day of Week
DSTR Date to Picture String Conversion
DVAL Date String to Numeric Value
EOM End of month
EOY End of year
HOUR Hour of Time
MDATE Query Magic's Date
MINUTE Minutes Value of Time Value
MONTH Month Value of a Date Value
NDOW Day of Week Number to Day Conversion
NMONTH Month Number to Name Conversion
SECOND Seconds Value of a Time Value
TIME System Time
TSTR Time to Picture String Conversion
TVAL Alpha to Time conversion
YEAR Year Value of Date Value

A few words to parameters and return values:
Unfortunately it is not possible to use parameters (even if passed by reference) to return data to Magic. Magic passes always a reference to a copy of the variable (used as parameter). I decided to code different values into a string, whenever a function has to return more than one value and return that. It's up to you, to decode that string to get the different values.

Usually the returned Alpha Strings look like (without the quotes) 'E,YYYYMMDD', where E is '1' to signal success and '0' for failure; 'YYYY' will be a year (e.g. '1999') .... You can use DVAL() with a proper picture to decode the date or STRTOKEN or some MIDs ...

Whenever I return a null terminated string pointer, it would be necessary to allocate dynamic memory for the data (If I'd use static memory, the dll would not be thread safe). This solution tends to be a source for many bugs, because you would be respobisble to deallocate these ressources. It is not possible to wait until Magic frees the library and do that automatically in some circumstances (consider a batch over a very large table and you call a UDF which allocates a certain amount of memory in every record loop).
So, I decided to leave that challenge to the engine. I am always writing to memory, that you pass as a parameter. Therefore there are always two additional parameters "strRetBuff" and "bufLen". Typically you SELECT a Virtual for strRetBuff and call the function with something like udf('mgdatutl.duX', ..., A, LEN(A)). As an alternative you could use someting like udf('mgdatutl.duX', ..., FILL(' ', 100), 100) (if you dont want to select a virtual for the call).
The function will return (address of) A. The variable should be declared long enough. If it is not long enough to contain *all* return values, I fill it up with question marks.
 
 
 

duIsLeapYear 
This function returns 1 if the given year is a leap year and 0 otherwise
Syntax  udf('mgdatutl.duIsLeapYear', Year )
Parameters  Year (Numeric) 
Returns  Numeric
Example  UDF('mgdatutl.duIsLeapYear', 2000) returns 1


 
 

duIsDate 
This function returns 1 if year, month and day constitute a valid date and 0 otherwise.
Syntax  udf('mgdatutl.duIsDate', Year, Month, Day)
Parameters  Year (Numeric) 
Month (Numeric)
Day (Numeric) 
Returns  Numeric
Example   


 
 

duIsBusinessDate 
This function returns 1 if year, week and day (of week) constitute a valid date and 0 otherwise.
Syntax  udf('mgdatutl.duIsDate', Year, Week, Day)
Parameters  Year (Numeric) 
Week of Year (Numeric)
Day of week (Numeric) 
Returns  Numeric
Example   


 
 

duDOW 
returns the number of the day of week of the date constituted by year, month and day (of month). It is similar to Magic's DOW, but it returns 1 for monday and 7 for sunday (ISO2015-1971 or DIN 1355).
Syntax  udf('mgdatutl.duDOW', Year, Month, Day)
Parameters  Year (Numeric) 
Month (Numeric)
Day of Month (Numeric) 
Returns  Numeric
Example   
Note In the Hebrew calendar (on which the Christian calendar is based), the week starts with Sunday and ends with the Sabbath (Saturday), where according to the Genesis the Lord rested from creating the world.
In medieval times, catholic popes have decreed the Sunday to be the official day of rest, in order to dissociate the Christian from the Hebrew belief.


 
 

duDOY 
duDOY returns the number of the day (Day Of Year) of the given date constituted by year, month and day (of month)
Syntax  udf('mgdatutl.duDOY', Year, Month, Day)
Parameters  Year (Numeric) 
Month (Numeric)
Day of Month (Numeric) 
Returns  Numeric
Example   
Note This function can be considered as a shortcut for a calculation using Magic's DVAL


 
 

duFDW
duFDW returns the date of the first day (the monday) of the given week
Format: E,YYYYMMDD
Syntax  udf('mgdatutl.duFDW', Week, Year, strRet, retLen)
Parameters  Week of year (Numeric) 
Month (Numeric)
Day of Month (Numeric) 
Returns  Alphanumeric
Example   


 
 

duWIY
returns the number of weeks in the given year
Syntax  udf('mgdatutl.duWIY', Year)
Parameters  Year (Numeric)
Returns  Numeric
Example  UDF ('mgdatutl.duWIY', 1999) returns 52, UDF ('mgdatutl.duWIY', 1998) returns 53
Note  


 
 

duWOY
returns the number of the week and the year, for the date constituted by year, month and day (of month)
Syntax  udf('mgdatutl.duWOY', Year, Month, Day, strRet, retLen)
Parameters  Year: Number, 1-9999
Month: Number, 1-12
Day: : Number, 1-31
strRet: Alpha String
retLen: Number, LEN(strRet)
Returns  Alpha String, (E,WW,YYYY)
Example   


 
 

duDateToDays
duDateToDays returns the number of days between 1 A.D. and the date constituted by year, month and day (of month)
Syntax  udf('mgdatutl.duDateToDays', Year, Month, Day)
Parameters  Year (Numeric)
Month (Numeric)
Day of month (Numeric)
Returns  Numeric
Example   


 
 

duWeek
returns the week number for the date  constituted by year,  month and day (of month).
if the date lies in the last week of the previous year, 0 is returned!
if the date lies in the first week of the next year, the function returns duWIY(year) + 1.
Syntax  udf('mgdatutl.duWeek', Year, Month, Day)
Parameters  Year (Numeric)
Month (Numeric)
Day of month (Numeric)
Returns  Numeric
Example   


 
 

duRepeatWOM
calculates the date of the n'th day of week in the given month and year. You can use that for recurring events like the tech meeting on every 2nd Monday of a month.
Syntax  udf('mgdatutl.duRepeatWOM', Year, Month, Dow, N, strRet, retLen)
Parameters  Year (Numeric) 
Month (Numeric)
Dow (Numeric) := Day of week (1 ... 7)
N (Numeric)
strRet (Alphanumeric)
retLen (Numeric)
Returns  Alphanumeric 'E,YYYYMMDD'
Example  date of 3rd Tuesday in December is DVAL(UDF('mgdatutl.duRepeatWOM', YEAR(DATE()), 12, 2, 3, FILL(' ', 32), 32), retLen), '  YYYYMMDD')


 
 

duStdToBusiness
returns a "business date" for a standard date constituded by year, month, day (of month).
In Business (esp. here in Germany) a date is often given as year, week, day of week.

returns: E,YYYYWWD
 E := Error-Code
 Y := Year
 W := Week
 D := Day of week

Syntax  udf('mgdatutl.duStdToBusiness', Year, Month, Day, strRet, retLen)
Parameters  Year: Number, 1-9999
Month: Number, 1-12
Day: : Number, 1-31
strRet: Alpha String
retLen: Number, LEN(strRet)
Returns  Alpha String
Example   


 
 

duBusinessToStd 
returns a standard date (coded as YYYYMMDD) for the "business date" constituded by year, week, day (of week).
returns: E,YYYYMMDD
Syntax  udf('mgdatutl.duBusinessToStd', Year, Week, Dow, strRet, retLen)
Parameters  Year (Numeric) 
Week (Numeric)
Day of Week (Numeric)
strRet (Alphanumeric)
retLen (Numeric)
Returns  Alpha String
Example   


 
 

duDayDiff
calculates the difference between two dates in number of days.
Syntax  udf('mgdatutl.duDayDiff(Year1, Month1, Day1, Year2, Month2, Day2) 
Parameters  Year1 (Numeric) 
Month1 (Numeric)
Day1 (Numeric)
Year2 (Numeric) 
Month2 (Numeric)
Day2 (Numeric)
Returns  Numeric
Example   


 
 

duTimeDiff
calculates the difference between two dates (with time)
Syntax  udf('mgdatutl.duTimeDiff(Year1, Month1, Day1, Hour1, Min1, Sec1, Year2, Month2, Day2, Hour2, Min2, Sec2, lpszRetBuff, bufLen)
Parameters  Year1 (Numeric) 
Month1 (Numeric)
Day1 (Numeric)
Hour1 (Numeric)
Sec1 (Numeric)
Year2 (Numeric) 
Month2 (Numeric)
Day2 (Numeric)
Hour2 (Numeric)
Sec2 (Numeric)
strRetBuf (Alphanumeric)
bufLen (Numeric)
Returns  Alpha String (E,DDDDDDDDDDHHHHHHHHHHMMMMMMMMMMSSSSSSSSSS)
Example   


 
 

duLocalTime
returns the LocalTime of the system
Syntax  udf('mgdatutl.duLocalTime(strRetBuff, bufLen)
Parameters  strRetBuf (Alphanumeric)
bufLen (Numeric)
Returns  Alpha String (E,YYYYMMDDHHMMSSDDDTZZ)
Example   


 
 

duEasterSunday
calculates the date of Easter Sunday for the given year.
Syntax  udf('mgdatutl.duEasterSunday(Year, strRetBuff, bufLen)
Parameters  Year (Numeric)
strRetBuf (Alphanumeric)
bufLen (Numeric)
Returns  Alpha String (E,YYYYDDMM)
Example  MID(UDF('mgdatutl.duEasterSunday(1999, A, LEN(A)), 7, 2) & MID(UDF('mgdatutl.duEasterSunday(1999, A, LEN(A)), 9, 2)
Note If you have the date of Easter Sunday, you can use ADDDATE to get following holydays:
Carnival Monday / Rosenmontag / Veille du Mardi Gras = -48 days
Mardi Gras / Karnevalsdienstag / Mardi Gras = -47 days
Ash Wednesday / Aschermittwoch / Mercredi des Cendres = -46 days
Palm Sunday / Palmsonntag / Dimanche des Rameaux = -7 days
Easter Friday / Karfreitag / Vendredi Saint = -2 days
Easter Saturday / Ostersamstag / Samedi de Paques = -1 days
Easter Monday / Ostermontag / Lundi de Paques = +1 days
Ascension of Christ / Christi Himmelfahrt / Ascension = +39 days
Whitsunday / Pfingstsonntag / Dimanche de Pentecote = +49 days
Whitmonday / Pfingstmontag / Lundi de Pentecote = +50 days
Feast of Corpus Christi / Fronleichnam / Fete-Dieu = +60 days


 
 

duCalendar
returns a simple Calendar for the given year and month. It is similar to the cal utility from unix.
Syntax  udf('mgdatutl.duCalendar(Year, Month, strRetBuff, bufLen)
Parameters  Year (Numeric)
Month (Numeric)
strRetBuf (Alphanumeric)
bufLen (Numeric)
Returns  Alpha String
Example  udf('mgdatutl.duCalendar(1999, 10, FILL(' ', 256), 256) returns
       October 1999
Mon Tue Wed Thu Fri Sat Sun
                  1   2   3
  4   5   6   7   8   9  10
 11  12  13  14  15  16  17
 18  19  20  21  22  23  24
 25  26  27  28  29  30  31


duRFCDate
returns a date/time stamp as e.g. used for HTTP/1.1
Syntax  udf('mgdatutl.duRFCDate(strWhich, strRetBuff, bufLen)
Parameters  strWhich (Alphanumeric)
RFC1123  
RFC850  
asctime  

strRetBuf (Alphanumeric)
bufLen (Numeric)

Returns  Alpha String
Example  udf('mgdatutl.duRFCDate('RFC1123', FILL(' ', 256), 256) returns
Sun, 06 Nov 1994 08:49:37 GMT
Note  All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. For the purposes of HTTP, GMT is exactly qual to UTC (Coordinated Universal Time). This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone, and MUST be assumed when reading the asctime format. HTTP-date is case sensitive and MUST NOT include additional LWS beyond that specifically included as SP in the grammar.

HTTP-date = rfc1123-date | rfc850-date | asctime-date
rfc1123-date = wkday "," SP date1 SP time SP "GMT"
rfc850-date = weekday "," SP date2 SP time SP "GMT"
asctime-date = wkday SP date3 SP time SP 4DIGIT
date1 = 2DIGIT SP month SP 4DIGIT
; day month year (e.g., 02 Jun 1982)
date2 = 2DIGIT "-" month "-" 2DIGIT
; day-month-year (e.g., 02-Jun-82)
date3 = month SP ( 2DIGIT | ( SP 1DIGIT ))
; month day (e.g., Jun 2)
time = 2DIGIT ":" 2DIGIT ":" 2DIGIT
; 00:00:00 - 23:59:59
wkday = "Mon" | "Tue" | "Wed"
| "Thu" | "Fri" | "Sat" | "Sun"
weekday = "Monday" | "Tuesday" | "Wednesday"
| "Thursday" | "Friday" | "Saturday" | "Sunday"
month = "Jan" | "Feb" | "Mar" | "Apr"
| "May" | "Jun" | "Jul" | "Aug"
| "Sep" | "Oct" | "Nov" | "Dec"

 
 

ADDDATE 
Performs calculation on a date variable
Constructs a date out of an input date and 3 values to be added to that date: Years, months, and days. The result is always a valid date.
Syntax  ADDDATE (date,years,months,days)
Parameters  date : A date
years : The number of years to add to date. May be zero.
months: The number of months to add to date. May be zero
days: The number of days to add to date. May be zero.
Returns  Date value
Example  ADDDATE('01/01/1992'DATE,1,2,2) returns 03/03/1993


 
 

ADDTIME 
Performs calculation on a time variable
Constructs a time out of an input time and 3 values to be added to that time: Hours, minutes and seconds. The resulting time is the original input time plus the number of hours, minutes, and seconds added to it.
Syntax  ADDTIME (time,hours,minutes,seconds)
Parameters  time : A time value.
hours : The number of hours to add to time
minutes: The number of minutes to add to time.
seconds: The number of seconds to add to time.
Returns  Time value.
Example  ADDTIME('12:00:00'TIME,1,2,3) returns 13:02:03
See also TVAL
Note Zero values of these parameters are ignored.


 
 

BOM 
Beginning of month
Returns the date of the start of the month specified in the parameter.
Syntax  BOM(date)
Parameters  a date or a date expression
Returns  Value of type DATE
Example  BOM ('05/10/93'DATE) returns '05/01/93'
See also BOY, EOM, EOY, ADDDATE, CDOW
Note  


 
 

BOY 
Beginning of year
Returns the date of the start of the year specified in the parameter.
Syntax  BOY(date)
Parameters  a date or a date expression
Returns  Value of type DATE
Example  BOY ('10/05/93'DATE) returns '01/01/93'
See also BOM, EOM, EOY, ADDDATE, CDOW
Note  


 
 

CDOW
Character Day of Week
Returns the name of the day (e.g., Sunday, Monday) from a date or a date expression.
Syntax  CDOW(date)
Parameters  date: A date or a date expression.
Returns  day in character string
Example  CDOW('01/28/92'DATE) returns 'Tuesday' where x contains, in effect, the date 01/28/92 (Tuesday), then CDOW(x+1) returns 'Wednesday'
See also DAY, DOW, NDOW
Note The use of DATE following '01/28/92' identifies the string as a date literal string, and should not be confused with the DATE() function. You can control the length of the day name by manipulating the length of the alpha variable that will hold it. For example, if you input the result of a CDOW operation to a 3-character alpha variable, Magic displays the first three letters of the day name (e.g., 'Mon', 'Tue').


 
 

CMONTH
Character Month
Returns the name of the month (e.g., January, February) from a date or a date expression.
Syntax  CMONTH(date) 
Parameters  date: A date or a date expression. 
Returns  Alpha string
Example  CMONTH('01/28/92'DATE) returns 'January' 
If X contains, in effect, the date 01/28/92, then CMONTH(X+30) returns 'February'
See also MONTH, NMONTH
Note he use of DATE following '01/28/92' identifies the string as a date literal string, and should not be confused with the DATE() function.
You can control the length of the month name by manipulating the length of the alpha variable that will hold it. For example, if you input the result of a CMONTH operation to a 3-character alpha variable, Magic displays the first three letters of the month name (e.g., 'Jan', 'Feb').


 
 

DATE
System Date
Returns the system date.
Syntax  DATE()
Parameters  none
Returns  Date
Example  If the system date is 01/28/92,
DATE() returns 28/01/92.
DATE()+5 returns 02/02/92.
See also MDATE,DSTR, DVAL
Note Magic automatically converts the date to the date format set in the Environment dialog (default), or to the picture of the variable that holds it. If the system date is set to the European format, you can display or print the system date in American format by changing the relevant parameter in the Environment dialog, or by defining a suitable picture for the variable that holds the date.


 
 

DAY
Day of Month
Returns the day portion of a date, i.e., a number 1-31.
Syntax  DAY(date)
Parameters  date: A date or a date expression.
Returns  Number
Example  DAY('01/28/92'DATE) returns 28.
The following expression displays the word "Overdue" if the system date is later than the 15th of the month:
IF(DAY(DATE())15,'Overdue','')
See also CDOW, DOW, NDOW
Note  


 
 

DOW
Day of Week
Returns the number of the day of the week from a date , where Sunday is 1, Monday is 2, and so on.
Syntax  DOW(date)
Parameters  date: A date .
Returns  Number
Example  DOW('29/01/92'DATE) (representing a Wednesday) returns 4.The following expression displays a message if the system date is a Sunday:
IF(DOW(DATE())=1,'Never on Sunday','')
See also CDOW, DAY, NDOW
Note  
DSTR
Date to Picture String Conversion
Converts a date or a date expression to a character string, according to a format.
Syntax  DSTR(date, picture)
Parameters  date : A date
picture: The format of the resulting character string. For more information see Pictures 
Returns  Alpha string
Example  DSTR ('01/28/92'DATE,'WWWWWWWW, MMMMMMMM DD, YYYY') returns 'Tuesday, January 28, 1992'
See also DVAL
Note The use of DATE following '01/28/92' identifies the string as a date literal string, and should not be confused with the DATE() function.


 
 

DVAL
Date String to Numeric Value
Converts a date entered or stored as a character string to a numeric value. The numeric value represents the number of days elapsed since the day before the first day of the 1st century (01/01/01) until the date that is being converted.
Syntax  DVAL(datestring, picture)
Parameters  datestring: A character string or an alpha expression that can be interpreted as a date (e.g., '01/01/92', 'Jan 1, 1992').
picture: The format for datestring. This parameter is required for Magic to read and interpret the character string or expression.
Returns  Number
Example  DVAL('01/01/92','MM/DD/YY') and DVAL('Jan 1, 1992','MMM DD, YYYY') each return 727198.
Where variable A contains 'January 1, 1992' DVAL(A,'MMMMMMMMM DD, YYYY') also returns 727198
See also DSTR
Note If picture does not correspond to the format of datestring, the function returns 0. 


 
 

EOM
End of month
Returns the date of the end of the month specified in the parameter.
Syntax  EOM(date)
Parameters  a date or a date expression
Returns  Value of type DATE
Example  EOM ('05/05/93'DATE) returns '05/31/93'
See also BOY, BOM, EOM, ADDDATE, CDOW
Note  


 
 

EOY
End of year
Returns the date of the end of the year specified in the parameter.
Syntax  EOY(date)
Parameters  a date or a date expression
Returns  Value of type DATE
Example  EOY ('11/17/93'DATE) returns '12/31/93'
See also BOY, BOM, EOM, ADDDATE, CDOW
Note  


 
 

HOUR
Hour of Time
Returns a number that represents the hours part of a time value or a time expression.
Syntax  HOUR(time)
Parameters  time: A time value or a time expression.
Returns  Number (01-99)
Example  HOUR('12:00:00'TIME) returns 12
Where the variable A contains the time value 14:00:00, the expression HOUR(A)+2 returns 16.
See also MINUTE, SECOND
Note  


 
 

MDATE
Query Magic's Date
Returns the Magic date (the date entered in the Logon window).
Syntax  MDATE()
Parameters  none
Returns  Date
Example  MDATE()+5 returns a date that is five days later than the Magic date. The numbers added or subtracted are interpreted as numbers of days.
See also DATE
Note  


 
 

MINUTE
Minutes Value of Time Value
Returns a number that represents the minutes part of a time value.
Syntax  MINUTE(time)
Parameters  time: A time value.
Returns  Number, 0-59
Example  MINUTE('12:15:00'TIME) returns 15
If A contains the time value '12:15:00', MINUTE(A)+2 returns 17.
See also SECOND, HOUR, TIME
Note The use of the TIME literal following '12:15:00' should not be confused with the TIME() function.


 
 

MONTH
Month Value of a Date Value
Returns the month portion of a date.
Syntax  MONTH(date)
Parameters  date: A date input.
Returns  Number, 1-12
Example  MONTH('01/28/1992'DATE) returns 1
See also DAY, YEAR
Note The use of the DATE literal following '01/28/1992' should not be confused with the DATE() function.


 
 

NDOW
Day of Week Number to Day Conversion
Converts the number of the day of the week (e.g. 1, 2) to the corresponding name (e.g., Sunday, Monday).
Syntax  NDOW(day of week)
Parameters  day of week: A number that represents the day of the week.
Returns  Alpha string (containing day-of-week description)
Example  NDOW(1) returns 'Sunday'. 
NDOW(DOW('01/28/1992'DATE)) returns 'Tuesday'.
See also DOW, CDOW
Note If the day of week is greater than 7, it is reduced by 7; e.g., 0,7,14,21... = Saturday.


 
 

NMONTH
Month Number to Name Conversion
Converts the number of the month, 1-12, to the corresponding name, January-December.
Syntax  NMONTH(month)
Parameters  month: A number that represents the month of the year, 1 to 12.
Returns  Alpha string 
Example  NMONTH(1) returns 'January'. 
NMONTH(MONTH('01/28/1992'DATE)) returns 'January'.
See also MONTH, CMONTH, NDOW
Note  


 
 

SECOND
Seconds Value of a Time Value
Returns a number that represents the seconds part of a time value.
Syntax  SECOND(time)
Parameters  time: A time value or a time expression.
Returns  Number, 0-59
Example  SECOND('12:15:48'TIME) returns 48 
If A contains the time value '12:15:48', SECOND(A)+2 returns 50
See also MINUTE, HOUR
Note  


 
 

TIME
System Time
Returns the system time
Syntax  TIME()
Parameters  None
Returns  Current Time value
Example  TIME() returns 17:08:42.
TIME()+5 adds 5 seconds to the system time, returning 17:08:47.
See also DATE, MDATE
Note  


 
 

TSTR
Translate Time to Character
Converts a time to a alpha string, according to a picture.
Syntax  TSTR(time, picture)
Parameters  time: A time to be converted.
picture: The format of the resulting character string. For more information see Pictures.
Returns  Alpha string containing converted date
Example  TSTR ('14:30'TIME,'HH:MM PM') returns '2:30 PM'
See also TVAL, DSTR, DVAL
Note NOTE: A blank picture converts using "HH:MM:SS".


 
 

TVAL
Alpha to Time conversion
Converts a time value stored as a alpha character string to a numeric value, according to a picture.
Syntax  TVAL(string,picture)
Parameters  string: An alpha string that can be interpreted as a time value (e.g., '02:30:00 PM').
picture: The format for string in which the time is stored. This parameter helps Magic read and interpret the character alpha string. For a full description see pictures or see Chapter 3, Data Items, of The Magic Reference
Returns  Time value
Example  TVAL('02:30:00 PM','HH:MM:SS PM') returns 14:30:00
See also TSTR, DVAL, DSTR
Note  


 
 

YEAR
Year Value of Date Value
Returns the year portion of a date, in four digits.
Syntax  YEAR(date)
Parameters  date: Input date.
Returns  Number of years
Example  If the System Date is 01/28/92, YEAR(DATE()) returns 1992
See also DAY, MONTH
Note  


 

Recomended Readings

Claus Tondering's highly recomended most comprehensive collection Calendar FAQ
Royal Greenwich Observatory leaflet The Date of Easter
Richard Thompson for IPS Radio & Space Services, Sidney, Australia: Determining the Date of Easter
Home Page forCalendar Reform