FORMULA LANGUAGE


Performing time-date operations
Example

A time-date value consists of a year, month, day, hour, minute, and second. You can use a time-date value "as is" in a time-date field, but must convert it with @Text to use it as a string. You can convert a string to a time-date value with @TextToTime.

A time-date constant is a date, a time, or both, in brackets. The date is the month, day, and year separated by a slash (/) or a hyphen (-) for OS/2. Year is optional and defaults to the current year; a 2-digit year means the 20th century if 50 or greater, and the 21st century if less than 50.

The time is the hour, minute, and second (optional; defaults to 0) separated by colons. You can use 24-hour time or add "PM" for afternoon hours. You can add the time zone to indicate another time zone. Separate the components with spaces. Some examples of time-date constants are [6/30/97], [5:30:00 PM], [17:30:00], [17:30 EST], and [6/30 5:30 PM].

Dates can be compared and subtracted. Subtraction yields a numeric value representing seconds. To measure the difference between two dates in days, divide the result by 86,400, which is the number of seconds in a day. For example, if you have two date fields, date1 containing [07/01/01] and date2 containing [07/05/01], the following returns 345,600:


To display the result as 4 days instead of 345,600 seconds, use the following code:
For more information on calculating dates, see @Adjust.

The following @functions determine and manipulate time-date values.

FunctionDescription
@AccessedReturns the time-date the document was last accessed.
@Adjust(time-date; y; m; d; h; m; s)Adjusts a time-date by the negative or positive values of the remaining parameters.
@BusinessDaysReturns the number of business days in one or more date ranges.
@CreatedReturns the time-date the document was created.
@Date(y; m; d)Returns the date for year, month, and day.
@Date(y; m; d; h; m; s)Returns the date for year, month, day, hour, minute, and second.
@Date(time-date)Returns the date for a time-date.
@Day(time-date)Extracts the day of the month from a time-date.
@Hour(time-date)Extracts the hour from a time-date.
@Minute(time-date)Extracts the minute from a time-date.
@ModifiedReturns the time-date the document was last edited and saved.
@Month(time-date)Extracts the month from a time-date as 1-12.
@NowReturns the current time-date.
@Now([ServerTime])Returns the current time-date for the server containing the current database.
@Now([ServerTime]; serverNames )Returns the current time-date for specified servers.
@Second(time-date)Extracts the seconds from a time-date.
@Time(h; m; s)Returns the time for hour, minute, and second.
@Time(y; m; d; h; m; s)Returns the time for year, month, day, hour, minute, and second.
@Time(time-date)Returns the time for a time-date.
@Today Returns today's date.
@TomorrowReturns tomorrow's date.
@Weekday(time-date)Returns the day of the week for a time-date as 1-7 (Sunday through Saturday).
@Year(time-date)Extracts the year from a time-date.
@YesterdayReturns yesterday's date.
@ZoneReturns the time zone setting of the current computer.
@ZoneReturns the time zone setting for a time-date.

Example
See Also