lr_save_datetime
Assigns the current date and time to a parameter.
void lr_save_datetime( const char *format, int offset, const char *name );
| Alphabetical Listing - C Language Utility Functions |
Arguments
| Name | Comments |
|---|---|
| format | The format of the retrieved date/time information. |
| offset | Offset from the current date and time, using the constants: DATE_NOW, TIME_NOW, ONE_DAY, ONE_HOUR, ONE_MIN. For example, TIME_NOW + ONE_HOUR |
| name | The name of the parameter to store the date/time information. |
The lr_save_datetime function saves the current date and time, or the date and time with the specified offset into a parameter. The resulting string will be truncated once it reaches MAX_DATETIME_LEN characters.
The format can be a format defined in an included header file, such as DATE_FM, which is defined in lrun.h. You can use the Datetime Format Codes to build a format with any combination of strings and codes. For example, depending on the definitions in your computer's locale, "The current month is %b" would return The current month is JAN. "%d%b%y" would return 29JAN97.
Return Values
No value is returned.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
In the following example, lr_save_datetime retrieves tomorrow's date.
lr_save_datetime("Tomorrow is %B %d %Y", DATE_NOW + ONE_DAY, "next");
lr_output_message(lr_eval_string("{next}"));
// Output: Action.c(4): Tomorrow is November 18 2014
These examples show the effect of formatting:
lr_save_datetime("%Y-%m-%d", DATE_NOW, "dateReceived");
lr_output_message(lr_eval_string("{dateReceived}"));
// Output: Action.c(7): 2014-11-17
lr_save_datetime("%m/%d/%Y %H:%M", DATE_NOW, "currDateTime");
lr_output_message(lr_eval_string("{currDateTime}"));
// Output: Action.c(10): 11/17/2014 15:14

