Caché Basic Reference
Day
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the day of the month as an integer between 1 and 31, inclusive.
Synopsis
Day(date)
Arguments
The date argument is any expression that represents a date as a string.
Description
The Day function locates and returns the numeric day portion of a date string as an integer. It performs no range validation on this number. The Day function accepts blanks, slashes (/), hyphens (-), or commas (,) (in any combination) as date component separators. Leading zeros and plus or minus signs may be included or omitted in the input string; leading zeros and signs are omitted from the output integer. The Day function locates the day portion in either of two ways:
If the Day function is unable to identify a day portion of a string, it returns 0.
Examples
The following example uses the Day function to return the current day of the month:
Dim MyDay
MyDay = Day(Date)
Print MyDay
 
The following examples use the Day function to obtain the day of the month from a specified date:
Dim MyDay
MyDay = Day("09-19-2005")  'MyDay contains 19.
Print MyDay
 
Dim MyDay
MyDay = Day("09/19/05")  'MyDay contains 19.
Print MyDay
 
Dim MyDay
MyDay = Day("Sept 19, 2005")  'MyDay contains 19.
Print MyDay
 
Dim MyDay
MyDay = Day("19 October")  'MyDay contains 19.
Print MyDay
 
Dim MyDay
MyDay = Day("19 Feb")  'MyDay contains 19.
Print MyDay
 
See Also