Skip to content

AcuDateTime Operators

Martin Danielsson edited this page Nov 17, 2025 · 3 revisions

acudatetime

Converts date strings to Acumatica-compatible datetime format with milliseconds.

Description

The acudatetime operator converts various date string formats into Acumatica's standard datetime format: yyyy-MM-dd HH:mm:ss.fff. It handles ISO 8601 formats and strips trailing zeros from milliseconds while preserving up to 3 decimal places.

Parameters

Parameter Type Description
dateString String The date string to convert. Can be any format parseable by .NET DateTime or ISO 8601 format like "2022-06-02T09:25:36.0830000"

Return Value

Returns a date string in format yyyy-MM-dd HH:mm:ss.fff (e.g., "2022-06-02 09:25:36.083").

Returns an empty string if the input is null, empty, or whitespace.

Example

Configuration

<Field name="CreatedDateTime">acudatetime($Created)</Field>
<Field name="ModifiedDateTime">acudatetime($LastModified)</Field>

Input Data

Created LastModified
2022-06-02T09:25:36.0830000 2023-01-15 14:30:00
2021-12-25T00:00:00.0000000 12/31/2022 23:59:59
2024-03-10T15:45:30.1234567

Output

CreatedDateTime ModifiedDateTime
2022-06-02 09:25:36.083 2023-01-15 14:30:00.000
2021-12-25 00:00:00 2022-12-31 23:59:59.000
2024-03-10 15:45:30.123

Behavior

  1. Parseable dates: If the input can be parsed by .NET's DateTime.TryParse(), it's formatted as yyyy-MM-dd HH:mm:ss.fff
  2. ISO 8601 format: For strings like "2022-06-02T09:25:36.0830000":
    • Replaces "T" with a space
    • Strips trailing zeros from milliseconds
    • Truncates to 3 decimal places if more are present
    • If all milliseconds are zero, omits the decimal part

Notes

  • The operator preserves up to 3 decimal places for milliseconds
  • Trailing zeros in milliseconds are removed
  • Empty or whitespace input returns an empty string
  • The "T" separator in ISO 8601 format is replaced with a space

acudatetime2

Converts date strings to Acumatica-compatible datetime format without milliseconds.

Description

The acudatetime2 operator converts various date string formats into Acumatica's datetime format without milliseconds: yyyy-MM-dd HH:mm:ss. This is useful when millisecond precision is not needed or not supported by the target field.

Parameters

Parameter Type Description
dateString String The date string to convert. Can be any format parseable by .NET DateTime or ISO 8601 format like "2022-06-02T09:25:36.0830000"

Return Value

Returns a date string in format yyyy-MM-dd HH:mm:ss (e.g., "2022-06-02 09:25:36").

Returns an empty string if the input is null, empty, or whitespace.

Example

Configuration

<Field name="CreatedDate">acudatetime2($Created)</Field>
<Field name="ModifiedDate">acudatetime2($LastModified)</Field>

Input Data

Created LastModified
2022-06-02T09:25:36.0830000 2023-01-15 14:30:00
2021-12-25T00:00:00.0000000 12/31/2022 23:59:59
2024-03-10T15:45:30.1234567

Output

CreatedDate ModifiedDate
2022-06-02 09:25:36 2023-01-15 14:30:00
2021-12-25 00:00:00 2022-12-31 23:59:59
2024-03-10 15:45:30

Behavior

  1. Parseable dates: If the input can be parsed by .NET's DateTime.TryParse(), it's formatted as yyyy-MM-dd HH:mm:ss
  2. ISO 8601 format: For strings like "2022-06-02T09:25:36.0830000":
    • Replaces "T" with a space
    • Completely removes all milliseconds/fractional seconds
  3. Empty input: Returns empty string

Differences from acudatetime

Feature acudatetime acudatetime2
Output format yyyy-MM-dd HH:mm:ss.fff yyyy-MM-dd HH:mm:ss
Milliseconds Included (up to 3 decimals) Excluded
Use case When precision is needed When precision is not needed

Notes

  • All milliseconds are stripped from the output
  • Empty or whitespace input returns an empty string
  • The "T" separator in ISO 8601 format is replaced with a space
  • This is the preferred operator when the target Acumatica field is defined as DateTime without fractional seconds

acudatetimenow

Returns the current date and time in Acumatica-compatible format.

Description

The acudatetimenow operator outputs the current system date and time in Acumatica's standard datetime format with milliseconds: yyyy-MM-dd HH:mm:ss.fff. This is useful for populating audit fields like CreatedDateTime or LastModifiedDateTime with the current timestamp.

Parameters

This operator takes no parameters.

Return Value

Returns the current date and time as a string in format yyyy-MM-dd HH:mm:ss.fff (e.g., "2025-11-16 14:30:25.847").

Example

Configuration

<Field name="ImportedDateTime">acudatetimenow()</Field>
<Field name="ProcessedDateTime">acudatetimenow()</Field>
<Field name="CreatedDateTime">acudatetimenow()</Field>

Output (example from running on 2025-11-16 at 14:30:25.847)

ImportedDateTime ProcessedDateTime CreatedDateTime
2025-11-16 14:30:25.847 2025-11-16 14:30:25.847 2025-11-16 14:30:25.847

Note: All records in the same transformation run will have the same or very similar timestamps since they are generated at execution time.

Use Cases

  • Audit trails: Populate CreatedDateTime, LastModifiedDateTime fields
  • Import tracking: Mark when data was imported
  • Batch processing: Timestamp records with processing time
  • Data versioning: Track when records were generated

Behavior

  • Returns the current system time at the moment the operator is evaluated
  • Includes milliseconds (3 decimal places)
  • Each record may have slightly different timestamps depending on processing speed
  • Uses the system's local time zone

Notes

  • This operator requires no arguments - use acudatetimenow() without parameters
  • The timestamp reflects when the transformation is running, not when the source data was created
  • For converting existing date strings, use acudatetime or acudatetime2 instead
  • Milliseconds are included in the output format

Clone this wiki locally