Date and Time Functions

Alpha Five provides the following Date and Time functions.

Group

 

Output

Function

Description

Arithmetic

V5

D

- (Date Subtraction)

+ (Date Addition)

Add or subtract a number of days to or from a date to produce a date.

V5

T

- (Date Time Subtraction)

+ (Date Time Addition)

Add or subtract a number of seconds to or from a date time to produce a date time.

V6

Y

- (Time Subtraction)

+ (Time Addition)

Add or subtract a number of seconds to or from a short time to produce a short time.

V5

N

- (Date Subtraction)

Subtract one date from another to produce the interval in days.

V5

N

- (Date Time Subtraction)

Subtract one date time from another to produce the interval in seconds.

V6

N

- (Time Subtraction)

Subtract one short time from another to produce the interval in seconds.

Calendars

V5

C

POPUP.CALENDAR()

Displays a calendar and returns a formatted date string.

V5

C

UI_GET_DATE()

Displays a Windows style dialog and returns formatted date string.

V5

C

UI_GET_DATE_CALENDAR()

Displays an HTML formatted dialog and returns a formatted date string.

General

V5

D

DATE()

Returns today's Date.

V8

D

Date_FirstDayOfMonth()

Returns the first date of a month relative to a specified date (default value is today).

V8

D

Date_FirstDayOfPreviousMonth()

Returns the first date of the previous month relative to a specified date (default value is today).

V8

D

Date_LastDayOfMonth()

Returns the last date of a month relative to a specified date (default value is today).

V8

D

Date_LastDayOfPreviousMonth()

Returns the last date of a previous month relative to a specified date (default value is today).

V6

N

GetTimeZoneOffset()

Returns the difference between the computer's time zone and Greenwich Mean Time.

V5

L

ISDATE()

Returns .T. if the character string is a valid representation of a Date value.

V6

L

IsShortTime()

Returns .T. if the character string is a valid representation of a Short Time value.

V6

L

ISTIME()

Returns .T. if the character string is a valid representation of a Time value.

V5

T

NOW()

Returns the current date/time, correct to the millisecond, in the Time data type.

V5

D

NULL_VALUE()

Assigns a NULL value to a date.

V6

D

A5_GETDATEHTML()

Displays a HTML calendar and returns a date.

V6

C

TZ_OFFSET_TO_C()

Calls the GetTimeZoneOffset() function and formats the result as a character string.

V7

P

WIN_TIME()

Returns information about the time settings of a computer.

Calculation Functions

V5

D

ADD_BUS_DAYS()

Adds a specified number of business days ( Add_Days ) to a Starting_Date and returns an Ending_Date.

V5

D

ADDMONTHS()

Returns an Ending_Date equal to the specified Starting_Date plus the specified Number_Of_Months.

V5

D

ADDYEARS()

Returns an Ending_Date equal to the specified Date plus the specified Number_Of_Year s.

V5

N

AGE()

Computes the number of years since a Starting_Date and returns an integer.

V5

N

BUS_DAYS_BETWEEN()

Computes the number of business days between two dates.

V8

N

Date_FirstDayOfMonth()

Given a date, returns the first day of its month.

V8

N

Date_FirstDayOfPreviousMonth()

Given a date, returns the first day of its previous month.

V5

L

DATE_IS_IN_MONTH()

Determines if a Date value is in a specified Month.

V8

N

Date_LastDayOfMonth()

Given a date, returns the last day of its month.

V8

N

Date_LastDayOfPreviousMonth()

Given a date, returns the last day of its previous month.

V5

D

INCREMENT_VALUE()

Increments the date by one.

V5

D

MONTH_END()

Returns the date of the last day of the month in which date occurs.

V5

D

MONTH_START()

Returns the date of the first day of the month in which date occurs.

V5

CD

NTH_DOW()

Returns the date for the Nth occurrence of the specified day of the week starting in the specified month and year.

Conversion Functions

V6

T

A5_T_FROM_RFCDATE()

Converts a date string formatted by A5_ANSIDATE(), A5_RFC1123DATE(), A5_RFC822DATE(), or A5_RFC850DATE() into a time-date value.

V5

D

CDATE()

Converts a Date to a Formatted_Date character string in the form "YYYYMMDD".

V5

C

CDOW()

Returns a character string containing the name of the day of the week for the specified Date.

V5

C

CMONTH()

Returns the Month_Name in the specified Date.

V6

T

CONVERT_TYPE()

Converts variables from one type to another, preserving the data if possible.

V7

C

CShortTime()

Converts a short time value to a sortable character equivalent.

V7

C

CTIME()

Converts a time value to a sortable character equivalent.

V5

D

CTOD()

Converts a character string containing date information to a Date value.

V6

T

CTODT()

Converts a date and time string to a date time value.

V6

Y

CTOT()

Converts a time string to a short time value.

V5

C

CYEAR()

Returns a character string containing the year in the form "YYYY" based on the specified Date_Value.

V5

CT

DATE_FORMAT()

Returns any portion of a Date_Time as a formatted string.

V5

D

DATE_VALUE()

Returns Date_Value for the specified year, month and day.

V5

N

DAY()

Returns an integer corresponding to the day of the month for a given Date or Date_Time.

V5

N

DAY_NUMBER()

Returns the number of a given day name.

V5

N

DOW()

Returns an integer indicating the day of the week for the Date_Value.

V7

N

DOW_ISO()

Returns the ISO day of the week.

V5

N

JDATE()

Converts Date_Value to a Julian date, which is an integer value measured in days from a special starting date.

V5

D

JTODATE()

Converts a Julian date (which is an integer value measured in days) to an Alpha Five Date value.

V5

N

MONTH()

Returns an integer equal to the month number (1-12) of the specified Date or Date_Time.

V5

N

MONTH_NUMBER()

Returns the month number (1 to 12) for a given month name.

V5

D

ODBC_DT_TO_D()

Converts a character Date_Time_String of format "YYYY-MM-DD HH:MM:SS.SSS" to a date value.

V5

T

SCANTIME()

Returns a Date_Time_Value in a Time variable by parsing the character date time value specified by Formatted_Date_Time according to the format specified by Format_String.

V8

Y

ShortTime_Extract()

Extracts the hours, minutes, or seconds value from a Short_Time.

V7

D

STOD()

Converts a date string in the format YYYYMMDD into a date.

V6

T

TIME_VAR()

Creates a "time" variable from year, month, day, hour, minute, and second values.

V5

N

TOSECONDS()

Converts a Formatted_Time_String containing a time value to an integer Count equal to the number of seconds past midnight.

V6

N

WEEK()

Returns the number of the week in the year for a date value.

V7

N

WEEK_ISO()

Returns the ISO week number.

V7

C

WEEK_ISO_FULL()

Returns the fully qualified ISO week number.

V6

T

WMI_DATE_TO_TIME()

Converts a CIM date time string as used by WMI to an Alpha Five Date Time value in the local time zone.

V5

N

YEAR()

Returns a four digit integer equal to the year portion of the specified Date or Date_Time.

V7

D

YearStart_ISO()

Returns the first day of the ISO year for a given year.

Formatting Functions

V5

 

Predefined Date Formats

Predefined date formats for use with functions such as  DTOC().

V5

 

Date and Time Format Elements

Rules for coding date and time formats.

V6

CD

A5_CONVERT_DATE_STRING()

Reformats a date string.

V7

CT

A5_CONVERT_DATETIME_STRING()

Reformats a date time string.

V5

CT

A5_RFC81123DATE()

Takes a date, either as a time or character, and converts it to a string, following the RFC 1123 format.

V6

CT

A5_RFC81123DATE()

Takes a date, either as a time or character, and converts it to a string, following the RFC 1123 format.

V6

CT

A5_RFC822DATE()

Takes a date, either as a time or character, and converts it to a string, following the RFC 822 format.

V6

CT

A5_RFC850DATE()

Takes a date, either as a time or character, and converts it to a string, following the RFC 850 format.

V5

CY

A5_TIMESTAMP()

Returns Formatted_Short_Time containing the system time

V5

CD

DATE_FORMAT()

Creates a formatted character string representation of the Date_Value.

V5

-

DATE_FORMATS_

BUILT_IN()

Displays the Data Format dialog box and returns the number of the selected format.

V5

CD

DMY()

Returns a formatted character string in the DD Month YYYY format for the specified Date_Value.

V5

CD

DTOC()

DTOC()returns a formatted character string for the specified Date or Date_Time value.

V5

CD

DTOS()

Converts a Date_Value to a Formatted_Date character string in the form "YYYYMMDD."

V5

CD

FORMAT_DATA()

Converts a Date_Value to a Formatted_Date character string. Refer to Display Formats.

V7

CD

FixDateString()

Reformats a Formatted_Date character string for web applications.

V5

CY

GMT()

Returns Greenwich Mean Time as a Formatted_Short_Time.

V5

CD

MDY()

Returns a Formatted_Date in the Month DD, YYYY format for the specified Date_Value.

V8

CY

SQL_DATE()

Formats a date value to "{YYYY-MM-DD}".

V5

CT

TIME()

Returns a character string with a formatted Date_Time_Value containing the system time.

V5

CY

TOTIME()

Returns a Formatted_Short_Time based on the specified Number_Of_Seconds past midnight.

See Also

Predefined Date Formats, Date and Time Format Codes, Date and Time Conversion Matrix