Date functions allow you to convert numbers to dates and dates to numbers.
This function returns the current date on a report.
Return value
The return value is a date.
Example
If today is Oct. 6,1999, the return value of the following statement is 10/06/99.
CurrentDate()
This function returns the current date and time on a report.
Return value
The return value is a DateTime.
Example
If today is Oct.6,1999, the current time is 5:10:27 p.m., the return value of the following statement is 1999-10-06 05:10:27 PM.
CurrentDateTime()
This function returns the current time on a report.
Return value
The return value is a Time.
Example
If the current time is 5:10:27 p.m., the return value of the following statement is 05:10:27 PM.
CurrentTime()
Returns a DateTime value to which a specified number of time intervals have been added.
This function is used to add interval of time to a DateTime. Its main feature is that the DateTime returned will always be valid. For example, the function takes into account such factors as the number of days in a month and leap years. If you want to add or subtract days to a DateTime, you could use the addition and subtraction operators instead of the function with the "d" parameter. However, this function also handles other types of intervals such as adding months or hours to a DateTime.
Parameters
IntervalType value | Description |
---|---|
yyyy | Year |
q | Quarter (3-month period) |
m | Month |
y | Day of year |
d | Day |
w | Weekday |
ww | Week (7-day period) |
h | Hour |
n | Minute |
s | Second |
Return value
A DateTime value.
Examples
DateAdd("yyyy",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one year. DateAdd("q",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus three months. DateAdd("m",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one month. DateAdd("y",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one day. DateAdd("d",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one day. DateAdd("w",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one day. DateAdd("ww",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus seven days. DateAdd("h",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one hour. DateAdd("n",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one minute. DateAdd("s",1,CurrentDateTime())
- Returns the DateTime value for current datetime plus one second. DateAdd("d",-32,ToDateTime(1999,9,28))
- Returns the DateTime value 1999-8-27 00:00:00.DateAdd("m",1,ToDateTime(1996,1,31))
- Returns the DateTime value 1996-2-29 00:00:00. Notice that DateAdd will not return the invalid value 1996-2-31 00:00:00.DateAdd("q",17,ToDateTime(1999,9,28))
- Returns the DateTime value 2003-12-28 00:00:00.DateAdd("h",-400,ToDateTime(1999,9,28))
- Returns the DateTime value 1999-9-11 08:00:00. In other words, this is the result of subtracting 400 hours from 1999-9-28 00:00:00.Notes:
ToDate(DateAdd("yyyy",-2,ToDateTime(1999,10,6)))
Returns a number of time intervals between two specified dates.
Overload
Parameters
IntervalType value | Description |
---|---|
Yyyy | Year |
Q | Quarter |
M | Month |
Y | Day of year |
D | Day (both "y" and "d" find the difference in days) |
W | Number of weeks between startDateTime and endDateTime |
Ww | Number of firstDayOfWeek's between startDateTime and endDateTime |
H | Hour |
N | Minute |
S | Second |
Constant | Description |
---|---|
jrUseSystem | 0 (Use the current system date) |
jrSunday | 1 |
jrMonday | 2 |
jrTuesday | 3 |
jrWednesday | 4 |
jrThursday | 5 |
jrFriday | 6 |
jrSaturday | 7 |
Return value
A Number value.
Examples
DateDiff("d", ToDateTime(1999,10,7), ToDateTime(1999,10,10))
- Returns 3
DateDiff("yyyy", ToDateTime(1999,10,7), ToDateTime(2005,2,10))
- Returns 6.DateDiff("yyyy", ToDateTime(1999,12,31), ToDateTime(2000,1,1))
- Returns 1 (a 1 year difference), even though there is only a 1 day difference between the dates.DateDiff("yyyy", ToDateTime(1999,1,1), ToDateTime(1999,12,31))
- Returns 0 (a 0 year difference), even though there is a 364 days difference.Suppose that for the above examples, the first date is the date that you bought a mutual fund, and the second date is the date you sold it. The mutual fund company must send you an annual report for every year in which you owned units in the fund. You would then get 7, 2 and 1 annual reports respectively, in the above cases.
DateDiff("q", ToDateTime(1999,10,6), ToDateTime(2003,5,20))
- Returns 14.DateDiff("q", ToDateTime(1999,3,31), ToDateTime(1999,4,1))
- Returns 1. The two dates are in adjacent quarters.DateDiff("q", ToDateTime(1999,1,1), ToDateTime(1999,3,31))
- Returns 0. The two dates are in the same quarter.Suppose the mutual fund company in the "yyyy" example mailed out quarterly reports. It would need to mail out 15, 2 and 1 quarterly reports respectively, in the above cases.
DateDiff("m", ToDateTime(1999,3,15), ToDateTime(1999,7,13))
- Returns 4.
DateDiff("w", ToDateTime(1999,10,19), ToDateTime(1999,10,25))
- Returns 0. DateDiff("w", ToDateTime(1999,10,19), ToDateTime(1999, 10,26))
- Returns 1.Returns a number that specifies a given part of a given date.
Overloads
Parameters
IntervalType value | Description |
---|---|
Yyyy | Extracts the year |
Q | Quarter (the result is 1, 2, 3 or 4) |
M | Month (the result is from 1 to 12) |
Y | Day of year (1 to 365 or 366 in a leap year) |
D | Day part of the date (1 to 31) Year |
W | Day of week (1 to 7 with the result depending on firstDayOfWeek) |
Ww | Week of year (1 to 53 with firstDayOfWeek and firstWeekOfYear determining the exact days of the first calendar week of the year) |
H | Extracts the hour part of the given DateTime (0 to 23) |
N | Minute part (0 to 59) |
S | Second part (0 to 59) |
Constant | Description |
---|---|
jrUseSystem | 0 (Use the current system date) |
jrSunday | 1 |
jrMonday | 2 |
jrTuesday | 3 |
jrWednesday | 4 |
jrThursday | 5 |
jrFriday | 6 |
jrSaturday | 7 |
Constant | Value | Description |
---|---|---|
jrUseSystem | 0 | Start with week in which system date occurs |
jrFirstJan1 | 1 | Start with week in which January 1 occurs (default) |
jrFirstFourDays | 2 | Start with the first week that has at least four days in the new year |
jrFirstFullWeek | 3 | Start with first full week of the year |
Examples
DatePart("d", ToDateTime(1999,8,15))
- Returns 15.DatePart("m", ToDateTime(1999,8,15))
- Returns 8.DatePart("n", ToDateTime(1999,8,15,10,35,0))
- Returns 35.DatePart("q", ToDateTime(1999, 9,29))
- Returns 3 since September 29 is in the third quarter of the year.DatePart("ww", ToDateTime(1997, 9,14))
- Returns 38 since 1997-9-14 is in the 38th week of 1997.Notes:
Note: If the year is less than or equal to 1899, and greater than or equal to 100, there will be no change to the date.
Parameters
Return value
A Date field with a four digit year.
Examples
DateTimeTo2000(ToDateTime(1998, 12, 12, 3, 2, 1), 99)
- Returns 2098-12-12 3:02:01.
DateTimeTo2000(ToDateTime(1995, 1, 2, 3, 2, 1), 94)
- Returns 1995-01-02 3:02:01.
DateTimeTo2000(ToDateTime(1899, 12, 12, 5, 6, 7), 99)
- Returns 1899-12-12 5:06:07.DateTimeTo2000(ToDateTime(999, 12, 12, 5, 6, 7), 99)
- Returns 999-12-12 5:06:07.DateTimeTo2000(ToDateTime(93, 12, 12, 5, 6, 7), 96)
- Returns 2093-12-12 5:06:07.DateTimeTo2000(ToDateTime(98, 12, 12, 5, 6, 7), 50)
- Returns 1998-12-12 5:06:07. This function evaluates the specified TimeStamp value and returns only the date.
Parameter
a - A TimeStamp value.
Return value
The return value is a date.
Example
If the current date is Oct. 17, 1999 and the current time is 12:27:15, the return value of the following statement is 10/17/99.
DateTimeToDate(CurrentDateTime())
This function evaluates the specified value and converts the time to the number of seconds from 00:00:00 to the specified time.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
If the current date is Oct. 17, 1999 and the current time is 12:27:15, the return value of the following statement is 44835.
DateTimeToSeconds(CurrentDateTime())
This function evaluates the specified TimeStamp value and returns only the time.
Parameter
a - A TimeStamp value.
Return value
The return value is a Time.
Example
If the current date is Oct. 17, 1999 and the current time is 12:27:15, the return value of the following statement is 12:27:15.
DateTimeToTime(CurrentDateTime())
Parameters
Return value
A Date field with a four digit year.
Examples
DateTo2000(ToDate(1993,12,12), 99)
- Returns 2093/12/12 because the window value is greater than the year, and so the date will be changed to 20XX.DateTo2000(ToDate(1993,12,12), 92)
- Returns 1993/12/12 because the window value is less than the year, and so the year will not be changed.DateTo2000(ToDate(1899,12,12), 99)
- Returns 1899/12/12.
DateTo2000(ToDate(100,12,12), 99)
- Returns 100/12/12.
DateTo2000(ToDate (98,12,12), 99)
- Returns 2098/12/12.DateTo2000(ToDate (98,12,12), 97)
- Returns 1998/12/12.DateTo2000(ToDate (9,12,12), 10)
- Returns 2009/12/12.DateTo2000(ToDate (1,12,12), 0)
- Returns 1901/12/12.Notes:
This function returns the day of the month.
Return value
The return value is an Integer.
Example
If today is Oct. 17, 1999, the return value of the following statement is 17.
Day()
This function extracts the day portion of a specified Date value.
Parameter
a - A Date value.
Return value
The return value is an Integer.
Example
If the current date is Oct. 17, 1999, the return value of the following statement is 17.
Day(CurrentDate())
This function extracts the day portion of a specified Date value.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
If the current date is Oct. 17, 1999 and the current time is 12:27:15, the return value of the following statement is 17.
Day(CurrentDateTime())
This function returns the day of the week.
Return value
The return value is an Integer.
Example
If today is Thursday, the return value of the following statement is 5.
DayOfWeek()
This function extracts the day portion of a specified Date value, and indicates which day of the week.
Parameter
a - A Date value.
Return value
The return value is an Integer.
Example
If today is Oct. 17, 1999 and today is Sunday, the return value of the following statement is 1.
DayOfWeek(CurrentDate())
This function extracts the day portion of a specified Date value, and indicates which day of the week.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
If the current date is Oct. 17, 1999, current time is 12:27:15 and today is Sunday, the return value of the following statement is 1 (Sunday is the first day of the week).
DayOfWeek(CurrentDateTime())
This function returns the day of the year.
Return value
The return value is an Integer.
Example
If today is Oct. 17, 1999, the return value of the following statement is 290.
DayOfYear()
Note: If the year is less than or equal to 1899 and greater than or equal to 100, there will be no change to the date.
Parameters
Return value
A DateTime string with a four digit year.
Examples
DTSTo2000("1988-12-12 12:12:12", 90)
- Returns 2088-12-12 12:12:12 because the window value is greater than the year, and so the year will be changed to 20XX.DTSTo2000("1988-12-12 12:12:12", 85)
- Returns 1988-12-12 12:12:12 because the window value is less than the year, and so the year will not change.DTSTo2000("1899/12/12 1:2:3am", 99)
- Returns 1899/12/12 1:2:3am.DTSTo2000("100/12/12 1:02:03AM", 99)
- Returns 100/12/12 1:02:03AM.DTSTo2000("98/12/12 1:02:03AM", 99)
- Returns 2098/12/12 1:02:03AM.DTSTo2000("98/12/12 1:02:03", 97)
- Returns 1998/12/12 1:02:03AM.DTSTo2000("9/12/12 1:02:03AM", 10)
- Returns 2009/12/12 1:02:03AM.DTSTo2000("1/12/12 1:02:03AM", 0)
- Returns 1901/12/12 1:02:03AM.Evaluates the specified string, and converts the Time value to the number of seconds from 00:00:00 (12:00 midnight) to the specified time.
Parameter
string - A String which includes a Date and a Time value.
Return value
Whole number.
Example
DTSToSeconds("2004/06/11 13:42:15")
- Returns 49335.
This function returns the first day of the month.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
If the current date is 11/24/2008, the return value of the following statement is 11/01/2008.
FirstDayOfMonth(CurrentDate())
This function returns the first day of the quarter.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
The return value of the following statement is 10/01/2008.
FirstDayOfQuarter(ToDate("11/24/2008"))
This function returns the first day of the week.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
The return value of the following statement is 11/23/2008.
FirstDayOfWeek(ToDate("11/24/2008"))
This function returns the first day of the year.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
The return value of the following statement is 01/01/2008.
FirstDayOfYear(ToDate("11/24/2008"))
This function returns the first Sunday of the month.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
The return value of the following statement is 11/02/2008.
FirstSundayOfMonth(ToDate("11/24/2008"))
This function returns the first Sunday of the year.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
The return value of the following statement is 01/06/2008.
FirstSundayOfYear(ToDate("11/24/2008"))
This function returns the Date portion of a specified DateTime value.
Parameter
a - A DateTime value.
Return value
The return value is a Date.
Example
If the DateTime is Dec.25,1999 20:12:50, the return value of the following statement is 12/25/99.
ForEachDay(ToDateTime(1999, 12, 25, 20, 12, 50))
If the day in the DateTime is less than 15, this function will return to the first day of the month. If the day is more than 15, it will return to the 16th day of the month.
Parameter
a - A DateTime value.
Return value
The return value is a date.
Examples
ForEachHalfMonth(ToDateTime(1999,9,13,12,27,15))
ForEachHalfMonth(ToDateTime(1999,10,18,5,21,22))
If the month of a specified DateTime is before July, the function will return to Jan.1 of the year. Otherwise the function will return to July 1 of the year.
Parameter
a - A DateTime value.
Return value
The return value is a date.
Examples:
ForEachHalfYear(ToDateTime(1999, 5, 28, 10, 10, 25))
ForEachHalfYear(ToDateTime(1998, 11, 15, 11, 40, 23))
This function returns the first day of the month in a specified DateTime value.
Parameter
a - A DateTime value.
Return value
The return value is a date.
Example
If the datetime is Sep.24,1999 12:05:56, the return value of the following statement is 09/01/99.
ForEachMonth(ToDateTime(1999,9,24,12,5,56))
If the month of a specified DateTime is before April, the function will return to Jan. 1 of the year. If the month is after April but before July, the function will return to April. 1 of the year. If the month is after July but before October, the function will return to July. 1 of the year. If the month is after October, the function will return to Oct.1 of the year.
Parameter
a - A DateTime value.
Return value
The return value is a date.
Examples
ForEachQuarter(ToDateTime(1997,2,14,2,10,23))
ForEachQuarter(ToDateTime(1999,5,28,10,10,25))
ForEachQuarter(ToDateTime(1999,8,28,10,10,25))
ForEachQuarter(ToDateTime(1998,11,11,11,40,23))
This function returns the Date of the first day of the week.
Parameter
a - A DateTime value.
Return value
The return value is a Date.
Example
If the DateTime is Oct. 15,1999 5:15:20 and it is Friday, the return value of the following statement is 10/10/99.
ForEachWeek(ToDateTime(1999, 10, 15, 5, 15, 20))
This function will return to Jan.1 of the year.
Parameter
a - A DateTime value.
Return value
The return value is a date.
Example
If the datetime is Aug. 28,1999 10:10:25, the return value of the following statement is 01/01/99.
ForEachYear(ToDateTime(1999, 8, 28, 10, 10, 25))
This function extracts the hour portion of the current time.
Return value
The return value is an integer.
Example
If the current time is 8:15:30, the return value of the following statement is 8.
Hour()
This function extracts the hour portion of a specified TimeStamp value.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
Suppose the datetime is Oct. 15,1999 9:35:22. The return value of the following statement is 9.
Hour(ToDateTime(1999,10,15,9,35,22))
This function extracts the hour portion of a specified Time value.
Parameter
a - A Time value.
Return value
The return value is an Integer.
Example
Suppose the time is 10:05:26. The return value of the following statement is 10.
Hour(ToTime(10, 5, 26))
Returns true if the given String or Number value can be converted to a valid Date and returns false otherwise. A valid Date is any Date between 100-1-1 and 9999-12-31.
Parameters
Return value
Boolean value, True or False.
Examples
IsDate(50)
- Returns true since the number 50 is interpreted as 50 days from Jan. 1, 1900, which is Feb 19, 1900.IsDate(-50)
- Returns true since the number –50 is interpreted as 50 days before Jan 1, 1900, which is Nov 11, 1899.IsDate("Feb 1, 2004")
- Returns true since the string is a right Date value and there is only one blank between 'Feb' and '1,' and '2004'.IsDate("2004 - 2 - 19")
- Returns false since the String format is not right Date format.IsDate("2003/2/29")
- Returns false since 2003 is not leap year.IsDate("2004*2*19")
- Returns false since the String format is not right Date format.Returns True if the given Number or String value can be converted to a valid DateTime, and returns False otherwise.
Parameters
Return value
Boolean value, true or false.
Examples
IsDateTime(15.2)
- Returns true since the given number argument is interpreted as the DateTime value 1900-01-15 04:48:00.IsDateTime("Feb 23, 2004 15:23:25")
- Returns true.IsDateTime("2004-2-23")
- Returns true.IsDateTime("15:23:25")
- Returns true.Returns True if the given Number or String value can be converted to a valid Time, and returns False if otherwise.
Parameters
Return value
Boolean value, true or false.
Examples
IsTime(0.5)
- Returns true since the given number argument is interpreted as 0.5 units of 24 hours, which is 12:00:00.IsTime(3.8)
- Returns true since the given number is interpreted as 3.8 units of 24 hours, which is 19:12:00.IsTime("8:30:00")
- Returns true since 8:30:00 is right Time value and format.IsTime("8 30:00")
- Returns false since the given string is not right Time format.IsTime("8:30:62")
- Returns false since the given string is not right Time value.This function returns the minute portion of the current time.
Return value
The return value is an Integer.
Example
If the current time is 12:41:27, the return value of the following statement is 41.
Minute()
This function returns the minute portion of a specified DateTime.
Parameter
a - A DateTime value.
Return value
The return value is an Integer.
Example
Suppose the datetime is Sep. 21,1997 12:20:25. The return value of the following statement is 20.
Minute(ToDateTime(1997, 9, 21, 12, 20, 25))
This function returns the minute portion of a specified time.
Parameter
a - A Time value.
Return value
The return value is an Integer.
Example
Suppose the time is 8:30:27. The return value of the following statement is 30.
Minute(ToTime(8,30,27))
This function adding one returns the current month of the year.
Return value
The return value is an Integer, which ranges from 0 to 11.
Example
If the current month is September, the return value of the following statement is 8.
Month()
This function extracts the month portion from a specified Date value.
Parameter
a - A Date value.
Return value
The return value is an Integer.
Example
If the date is June 15,1999, the return value of the following statement is 6.
Month(ToDate(1999, 6, 15))
This function extracts the month portion from a specified TimeStamp value.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
If the timestamp is July 15, 1999 10:10:10, the return value of the following statement is 7.
Month(ToDateTime(1999, 7, 15, 10, 10, 10))
Returns a String name for the specified month.
Parameters
Return value
String value.
Examples
MonthName(4)
- Returns String value "April".MonthName(12, true)
- Returns String value "Dec".MonthName(12, false)
- Returns String value "December".This function prints the current time on a report.
Return value
The return value is a Time.
Example
If the current time is 1:24:35 in the afternoon, the return value of the following statement is 1:24:35 PM.
Now()
Returns the quarter for the given date (1 for the first quarter).
Overloads
Parameters
Return value
Return an integer (1, 2, 3, 4).
Examples
This function extracts the second portion of the current time.
Return value
The return value is an Integer.
Example
If the current time is 4:55:03, the return value of the following statement is 3.
Second()
This function extracts the second portion of a specified TimeStamp.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
Suppose the datetime is Oct. 15,1999 10:15:17, the return value of the following statement is 17.
Second(ToDateTime(1999, 10, 15, 10, 15, 17 ))
This function extracts the second portion of a specified time.
Parameter
a - A Time value.
Return value
The return value is an Integer.
Example
Suppose the time is 7:51:59, the return value of the following statement is 59.
Second(ToTime(7, 51, 59))
Returns the date selected in the calendar or returns today() when no calendar is available for selecting a date.
There is a built-in expression Selected Date in Calendar calling this function. The expression can be found in the Name drop-down list of the Calendar dialog.
Return value
Date value.
Example
If the calendar date is March 12, 2012, the function returns 03/12/2012.
Returns the number of seconds elapsed since midnight.
Return value
Number value.
Example
If the current time is 9:28:30am, the function returns 34110.
Uses the function IsDate(number or string) to check whether the number/string is right or not. If the number/string is right, the function returns a Date value between 100-1-1 and 9999-12-31. If the number/string is wrong, it returns null.
Parameters
Return value
Date value or null.
Examples
ToDate(50.5)
- Returns 1900-2-19 since fraction is truncated.ToDate(-50)
- Returns 1970-01-01.ToDate(22222222)
- Returns 1970-01-01.ToDate("2004 2 19")
- Returns 2004-2-19.ToDate("99-5")
- Returns 1999-5-1.ToDate("1999-2-29")
- Returns null since 1999 is not leap year.This function returns the specified date.
Parameter
a - A Date value.
Return value
The return value is a Date.
Example
Suppose the date is July 15, 1999, the return of the following statement is 07/15/99.
ToDate(ToDate(1999, 7, 15))
This function extracts the date portion of a specified DateTime.
Parameter
a - A TimeStamp value.
Return value
The return value is a Date value.
Example
Suppose the DateTime is July 15,1999 12:20:30, the return value of the following statement is 07/15/99.
ToDate(ToDateTime(1999, 7, 15, 12, 20, 30 ) )
This function converts the argument d (A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT) to a data value.
Parameter
d - A Milliseconds value, a DBField value or a parameter. It should be a long integer.
Return value
The return value is a Date.
Example
The return value of the following statement is 01/02/70.
ToDate(72000000)
Note: When the milliseconds value is larger than 2³², you should use DBField or parameter instead.
This function creates a Date value from arguments y, m and d.
Parameters
Return value
The return value is a Date.
Example
The return value of the following statement is 07/15/99.
ToDate(1999, 7, 15)
Use the function IsDateTime to check whether the number/string is right or not. If it is right, the function returns a DateTime value between 100-1-1 and 9999-12-31, otherwise the function returns null.
Parameters
Return value
DateTime value or null.
Examples
ToDateTime(255.35)
- Returns 1900-09-12 08:23:59.ToDateTime("Jan 3, 2004")
- Returns 2004-01-03 00:00:00.ToDateTime("5:25:26pm")
- Returns 2004-02-23 17:25:26 because the current date is 2004-2-23.ToDateTime("2003-2-29 15:26:25")
- Returns null because the given String value is not right DateTime value.ToDateTime("2004 *2 *29 15:26:25")
- Returns null because the given String format is not right DateTime format. Returns a DateTime value.
Parameter
a - A Date value that can be converted to a DateTime type value by this function.
Example
ToDateTime(ToDate("2004-2-23"))
- Returns 2004-02-23 00:00:00.
This function creates a TimeStamp value from arguments a and b.
Parameters
Return value
The return value is a DateTime.
Example
Suppose the date is July 15,1999 and the time is 12:20:30, the return value of the following statement is 1999-07-15 12:20:30.
ToDateTime(ToDate(1999, 7, 15), ToTime(12, 20, 30))
This function converts the argument d (A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT) to a TimeStamp value.
Parameter
d - A Milliseconds value, a DBField value or a parameter. It should be a long integer.
Return value
The return value is a DateTime.
Example
The return value of the following statement is 1970-01-02 04:00:00.
ToDateTime(72000000)
Notes:
This function creates a TimeStamp value from arguments y, m and d.
Parameters
Return value
The return value is a DateTime.
Example
Suppose the date is July 15,1999, the return value of the following statement is 1999-07-15 12:00:00.
ToDateTime(1999, 7, 15)
Note: In this function, because you only input year, month and day, the system will output 12:00:00 as the default time. Also you can decide the display format by selecting the format from the Report Inspector. The format of the example above is yyyy-mm-dd hh:mm:ss.
This function creates a TimeStamp value from arguments y, m, d, h, i and s.
Parameters
Return value
The return value is a DateTime.
Example
Suppose the date is July 15,1999 and time is 8:05:30, the return value of the following statement is 1999-07-15 08:05:30.
ToDateTime(1999, 7, 15, 8, 5, 30)
This function returns the current date on a report.
Return value
The return value is a date.
Example
If the current date is Oct. 11, 1999, the return value of the following statement is 10/11/99.
Today()
Use the function IsTime to check whether the number/string is right or not. If the number/string is right, the function returns a Time value between 00:00:00 and 23:59:59, otherwise it will return null.
Parameters
Return value
Time value or null.
Examples
ToTime(0.2)
- Returns 04:48:00.ToTime(-0.2)
- Returns 19:12:00.ToTime(50)
- Returns 00:00:00.ToTime("10:34:25")
- Returns 10:34:25.ToTime("2:25pm")
- Returns 02:25:00.ToTime("2004-2-20")
- Returns 00:00:00.ToTime("24:25:23")
- Returns 00:25:23.ToTime("20*23:25")
- Returns null since the given String format is not time format.This function extracts the time portion from a specified TimeStamp value.
Parameter
a - A TimeStamp value.
Return value
The return value is a Time.
Example
Suppose the date is July 15,1999 and time is 10:55:45. The return value of the following statement is 10:55:45.
ToTime(ToDateTime(1999, 7, 15, 10, 55, 45 ))
This function converts the argument t (A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT) to a Time value.
Parameter
t - A milliseconds value, a DBField value or a parameter. It should be a long integer.
Return value
The return value is a Time.
Example
The return value of the following statement is 08:00:01.
ToTime(1000)
Note: When the milliseconds value is larger than 2³², you should use DBField or parameter instead.
This function creates a Time value from argument a, b and c.
Parameters
Return value
The return value is a Time.
Example
The return value of the following statement is 10:10:10.
ToTime(10, 10, 10)
WeekdayName returns a string indicating the name of the specified day of the week.
Overloads
Parameters
Constant | Description |
---|---|
jrUseSystem | 0 (Use the current system date) |
jrSunday | 1 |
jrMonday | 2 |
jrTuesday | 3 |
jrWednesday | 4 |
jrThursday | 5 |
jrFriday | 6 |
jrSaturday | 7 |
Return value
String value.
Examples
WeekdayName (2)
- Returns String value Monday.WeekdayName (1)
- Returns String value Sunday.WeekdayName (4, true)
- Returns String value Wed.WeekdayName (4, false)
- Returns String value Wednesday.WeekdayName (3, true, "jrMonday")
- Returns Wed, since abbreviation is selected and the first day of the week is specified to be Monday.WeekdayName (3, true, "jrUseSystem")
- If the current day is Friday, the function returns Sun, since the first day of week is specified to the current day, and the third day from Friday is Sunday.This function computes the total number of weeks from 1970 to the current date.
Return value
The return value is an Integer.
Example
If the current date is Oct. 13,1999, the return value of the following statement is 1554.
WeekFrom1970()
This function computes the total number of weeks from 1970 to a specified date.
Parameter
a - A Date value.
Return value
The return value is an Integer.
Example
Suppose the date is July 8,1995. The return value of the following statement is 1331.
WeekFrom1970(ToDate(1995, 7, 8))
This function computes the total number of weeks from 1970 to a specified DateTime.
Parameter
a - A DateTime value.
Return value
The return value is an Integer.
Example
Suppose the DateTime is Jan. 2,1988 10:40:50. The return value of the following statement is 940.
WeekFrom1970(ToDateTime(1988, 1, 2, 10, 40, 50))
This function returns the week of the current month.
Return value
The return value is an Integer.
Example
If the current date is Oct. 13,1999, the return value of the following statement is 3.
WeekOfMonth()
This function returns the week of the month of a specified date.
Parameter
a - A Date value.
Return value
The return value is an Integer.
Example
If the current date is Oct. 13,1999, the return value of the following statement is 3.
WeekOfMonth(ToDate(1999, 10, 13))
This function evaluates the week of the month of a specified TimeStamp.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
Suppose the timestamp is Jan. 20,1999 10:40:50. The return value of the following statement is 4.
WeekOfMonth(ToDateTime(1999, 1, 20, 10, 40, 50))
This function returns the week of the current year.
Return value
The return value is an Integer.
Example
If the current date is Oct. 13,1999, the return value of the following statement is 42.
WeekOfYear()
This function returns the week of the year in a specified date.
Parameter
a - A Data value.
Return value
The return value is an Integer.
Example
Suppose the date is July 8,1999. The return value of the following statement is 28.
WeekOfYear(ToDate(1999, 7, 8))
This function returns the week of the year in a specified TimeStamp.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
Suppose the timestamp is Feb. 4,1999 10:40:50. The return value of the following statement is 6.
WeekOfYear(ToDateTime(1999, 2, 4, 10, 40, 50))
This function returns the current year.
Return value
The return value is an Integer.
Example
If the current year is 1999, the return value of the following statement is 1999.
Year()
This function extracts the year portion of a specified date.
Parameter
a - A Data value.
Return value
The return value is an Integer.
Example
Suppose the date is Jan.15,1995. The return value of the following statement is 1995.
Year(ToDate(1995, 1, 15))
This function extracts the year portion of a specified TimeStamp value.
Parameter
a - A TimeStamp value.
Return value
The return value is an Integer.
Example
Suppose the timestamp is July 15,1988 10:40:50. The return value of the following statement is 1988.
Year(ToDateTime(1988, 7, 15, 10, 40, 50))