CURRENT_DATE macro

The CURRENT_DATE macro is available in Unica Campaign and Unica Interact.

Syntax

CURRENT_DATE([format])

Parameters

format

One of the keywords in the following table specifying the date format of date_string.

Note: See "Valid Format Keywords" for more information on available date formats.

Description

CURRENT_DATE returns the current date in format. The date is determined by the clock on the server. If no format keyword is supplied, the default of DELIM_M_D_Y is used.

For all recommended databases, Unica Campaign attempts to run the CURRENT_DATE macro in the database using a database-supported current time SQL call (e.g., SYSDATE, GETDATE, DATE, or TODAY). In these cases, all parameters (including the format of the date) of this macro function are ignored and the output includes whatever is returned by the database (e.g., a time component may be included in the output). If this occurs and you want to return just the date or the date in a different format, you can write your own custom macro using raw SQL or use other macros. For example:

DATE_STRING(CURRENT_JULIAN( ), ...)

In some cases, the CURRENT_DATE() macro is run on the Unica Campaign server (e.g., if running against a flat file, against a non-recommended database with no equivalent SQL support, or if the Campaign macro expression cannot be resolved in the database). In these cases, all parameters are recognized and the output is returned in the selected format.

Note: Not all formats available in Unica Campaign are supported by Unica Interact.

Note that you might have to use the DATE_FORMAT macro to adjust the CURRENT_DATE for your database type. For example, the following macro works with DB2:

table_name = CURRENT_DATE()-1

However, for Oracle, you must use the DATE_FORMAT macro as follows:

table_name = DATE_FORMAT(CURRENT_DATE()-1, DELIM_M_D_YYYY,'%Y-%m-%d')

Examples

If the date today is the 13th of September, 2015, CURRENT_DATE() returns "09/13/15".

Related functions

Function Description
DATE_FORMAT Converts dates from one format to another.
DATE_JULIAN Returns the Julian date of the input.
DATE_STRING Returns the date string of the Julian date.
DATE Converts a date string to Julian date.