$datim

Return the system date and time, or convert the argument to the Datetime data type.

$datim { (Source) }

Parameters

Parameters
Parameter Data Type Description
Source String String to be converted to Datetime data type. The string must be formatted as: dd-mm-yyhh:nn:ss.tt
  • dd—day
  • mm—month
  • yy—year
  • hh—hour
  • nn—minute
  • ss—second
  • tt—tick, that is hundredth of a second, prefixed by a separation character, a dot, or a semicolon

Return Values

Value with data type Datetime:

  • If Source is given, $datim converts Source to the corresponding date and time.

    Source should be formatted according to the Default Date-Time Format, which depends on the language setup that is current at run time. If the current language setup has no default Date-Time Format defined, dd-mmm-yy hh:nn:ss:tt is used.

  • If Source is omitted, the function returns a string containing the system clock time as ccyymmddhhnnsstt, accurate to one hundredth of a second (1 tick). For example: 2007010512322478.
  • If Source cannot be converted to a Date value (for example, $datim("abc")), $datim returns an empty string ("").
  • If a service or report component is running in a remote environment, $datim returns the system time of the server (not of the client).
Examples of $datim Return Values with Date-Time Formats
Field Layout Definition Value Returned by $datim
hh:nn:ss.tt 12:32:24.78
hh:nn:ss 12:32:24
dd-MMM-yyyy hh:nn:ss.tt 01-MAY-2007 23:30:43.67
dd-MMM-yyyy hh:nn:ss.tt and Source is "01-05-0723:30:43" 01-MAY-2007 23:30:43.00. Note that the 00 ticks are returned.

If an error occurs, $procerror contains a negative value that identifies the exact error.

Values Commonly Returned by $procerror After $datim

Value

Error Constant

Meaning

-1006

UPROCERR_DATETIME

Not a valid Datetime value.

Use

Allowed in all component types.

Description

Used without Source, $datim returns the system date and time. You can use $datim in ProcScript to assign the current date to fields in header or footer frames, or to put a timestamp on occurrences. The time returned is accurate to one hundredth of a second (1 tick).

Used with Source, $datim converts Source to a value with data type Datetime. The way the data is interpreted and formatted depends on the locale, as determined by the values of $nlslocale and $nlsformat. For more information, see $date.

When the locale is set to classic, the conversion process is governed by the format of the default date. The default language setup used by an application is governed by the values of $language and $variation.

Using $datim

The following example assigns the current system date and time to the field DATE.HEADER:

trigger getFocus ; of entity HEADER.USYS
  DATE.HEADER = $datim
end
Version Change
9.2.01 When Source is omitted, accuracy is to one hundredth of a second (1 tick) instead of to the second.

Related Topics