Text manipulation functions  Miscellaneous functions

Chapter 3: Building Production Objects

Date/time functions

These functions append the date and/or time in a specific format to the current output blob area.


currDateHL7()

Description

Adds the current date in HL7 format YYYYMMDDHHMMSS#PPPP where “#PPPP” is plus or minus hours and minutes from Greenwich Mean Time (GMT).

Arguments

None.

Examples

0844” is 8 hours and 44 minutes from GMT.


currEuroDate()

Description

Adds the current date in the format: DD.MM.YYYY; for example, “20.12.2005”.

Arguments

None.


currMMDDYY()

Description

Adds the current date in the format MMDDYY; for example, “032005”.

Arguments

None.


currMMDDYYSlash()

Description

Adds the current date in the format MM/DD/YY; for example, “02/17/05”.

Arguments

None.


currMMDDYYYY()

Description

Adds the current date in the format MMDDYYYY, for example, “09072005”.

Arguments

None.


currYYMMDD()

Description

Adds the current date in the format YYMMDD; for example, “050501”.

Arguments

None.


currHHMMSS()

Description

Adds the current time in the format HHMMSS; for example, “231104”.

Arguments

None.


currHHMMSSColon()

Description

Adds the current time to current output blob area in the format HH:MM:SS.

Arguments

None.


fmtAge()

Description

Calculates as an age the difference between the current date and the date in the current blob area, and replaces the current blob area with the result. If the date in the current blob area is in the future, this function returns the difference as a negative value. The date in the current blob area must be in one of the following formats—yymmdd, yyyymmdd, yy/mm/dd, or yyyy/mm/dd.

Arguments

Date Format – use one or more format specifiers and any ordinary characters. Valid specifiers are %y for the age in years, %d for the remainder of the age in days (use with the %y specifier), and %D for the entire age in days.

Examples

The two-digit date in the Window Year field is “50”. The two dates passed are “01/01/01” and “99/12/31”. The 01 and 99 are compared to the 50 that is in the Window Year filed, and 01 is assigned a 2000 base (2001) because it is less than or equal to 50, and the 99 is assigned a 1900 base (1999) because it is greater than 50.

When setting the Window Year date, if you set it to a date that is low, you must increase it to before the end of the year so the engine does not revert to 1900 when the year is over.


fmtCurrDate()

Description

Adds the current date and/or time to the current output blob area. Format depends on the format specifier used. All characters that are not format specifiers are copied unchanged into the output blob area in the same position as they are in the arguments.

This string consists of zero or more conversion specifications and ordinary characters. Ordinary characters, such as dashes, are copied directly into the buffer. A conversion specification consists of a percent sign and one other character.

Arguments

Date Format – any format specifier that is valid with the C function strftime(), and any ordinary characters; for example, “%m - %d - %y”.

NoteRefer to your platform and version-specific C developers guide for the valid strftime() arguments available to you. These arguments may vary depending on platform and OS version.


fmtDateDiff()

Description

Calculates the difference between the date in the current blob and the date specified in either the FieldObj argument or the Datalink argument, and replaces the current blob area with the result. The date in the current blob area must be in one of the following formats: yymmdd, yyyymmdd, yy/mm/dd, or yyyy/mm/dd.

NoteIf either of the dates you are passing have a base year of 1800, you must use either the yyyymmdd or yyyy/mm/dd format. If the date specified in either the FieldObj argument or the Datalink argument is earlier, chronologically, than the current blob, the result is a negative number.

Arguments

Examples


fmtDate()

Description

Converts from an input date format to an output date format. The format of the incoming data can be described by a field object, a datalink, or a literal. The fields are mutually exclusive. If no field object is specified, the datalink is used; if no datalink is specified, the literal is used.

The format of the incoming date is specified using any number of these characters and any other ordinary characters:

Character

Description

D

Day of the month.

M

Month of the year.

Y

Year.

J

Julian date (1-366).

j

Julian date (0-365).

W

Day of the week, starting Sunday (1-7).

w

Day of the week, starting Sunday (0-6).

The output format must be described by a literal, using C date-formatting specifiers. YYJJJ formats use a century value based on the option button selected in the Filter Information window. In the Filter Information window you can select a 1900 or 2000 year base. You can also trust the current OS base.

Arguments

Examples

When In Literal is “MMDDYY” (as in 123197) and Out is “%m - %d - %y”, the result becomes “12 - 31 - 97”.

NoteRefer to your platform and version-specific C developers guide for the valid strftime() arguments available to you. These arguments may vary depending on platform and OS version.


fmtGregorian()

Description

Converts the incoming data from a Gregorian format (YYMMDD or YYYYMMDD) to the format indicated by the arguments and places it into the current output blob area.

Arguments

Date Format – any format specifier that is valid with the C function strftime() and any ordinary characters.

Examples

%D, %Y

NoteWhen setting the Window Year date, if you set it to a date that is low, you must increase it before the end of that year so the engine does not revert to 1900 when that year is over.

Refer to your platform and version-specific C developers guide for the valid strftime() arguments available to you. These arguments may vary depending on platform and OS version.


fmtJulian()

Description

Converts the incoming data from Julian format (YYJJJ or YYYYJJJ) to the format indicated by the arguments and places it into the current output blob area.

Arguments

Date Format – any format specifier that is valid with the C function strftime() and any ordinary characters.

Examples

%a,%m,%d,%Y

NoteBe careful when setting the Window Year date. If you set it to a date that is low, remember to increase it before the end of that year, so that the engine does not revert to 1900 when that year is over.





Copyright © 2005. Sybase Inc. All rights reserved. Miscellaneous functions

View this book as PDF