Format Date Time

Converts a date and/or time into the specified format. Used to modify a date value so that it matches a required format. For example, the application being automated may require a date to be input in a specific format such as yyyy-dd-mm. This action would be used to modify the value accordingly.

Declaration

<AMTEXTFORMATDATETIME DATETIMEFORMAT="text" INCLUDEAMPM="YES/NO" RESULTVARIABLE="text" ACTION="text(options)" SPECIFIEDDATETIME="date" SPECIFIEDFORMAT="date format" ADJUSTYEAR="number" ADJUSTDAY="number" />

See Also: Find Text, Get Subtext, Insert Text, Pad Text, Replace Text, Trim Text, Introduction to Functions, Introduction to Extended Functions

General Tab

Property

Type

Required

Default

Markup

Description

Date time format

Text

Yes

(Empty)

DATETIMEFORMAT="dd/mm/yyyy hh:nn:ss"

The format that should be used when the date is output. Click the provided drop-down arrow to select a specific format from the list that appears or you can manually enter a custom format using valid characters. The following special characters are used to create a date format:

y = year

m = month

d = day

h = hour

n = minute

s = second

hh = leading zero (Example: 03)

h = no leading zero (Example: 3)

NOTE: The result will appear in its entirety in the Formatted date time field.

12 hour format

Yes/No

No

Yes

SPECIFIED12HOUR="no"

Specifies whether hours of the day will be based on a 12 or 24 hour clock. If set to YES (default), a 12 hour clock format will be used. If set to NO, a 24 hour clock format will be used.

Include AM/PM in result

Yes/No

No

No

INCLUDEAMPM="yes"

Indicates whether an AM or PM indicator should be added to the end of the formatted date time value. If set to YES, the formatted date will be followed with an AM or PM indicator. If set to NO (default), no AM/PM indicator will be included. This option is only available if the 12 hour format parameter is set to YES.

Populate Variable with Result

Text

Yes

(Empty)

RESULTVARIABLE="varname"

Indicates an already existing variable in which to populate with the formatted date/time.

Attributes Tab

Property

Type

Required

Default

Markup

Description

Action

Text (options)

No

Use current date time

ACTION="specified"

Specifies the source of the date time value to be formatted. Different parameters become available depending on the option selected. The available options are:

  • Use current date time (default): The current date and time will be used.

  • Use specified date time: The specified date and time will be used.

  • Prompt user: At runtime, a dialog is presented prompting the user to select a date/time.

Specified Date Time

Text

Yes if Action is set to Use specified date time

Current date/time

PECIFIEDDATETIME="6/12/2005 1:42:40 PM"

Indicates the date/time to format. This parameter is available only if the Action parameter is set to Use specified date time.

Will be in the format

Text

Yes if Action is set to Use specified date time

m/d/yyyy h:nn:ss

SPECIFIEDFORMAT="dd/mm/yy hh:nn:ss"

The format that should be applied when attempting to read the date/time entered in the Specified Date Time parameter. This parameter is available only if the Action parameter is set to Use specified date time.

Prompt Message

Text

Yes if Action is set to Prompt user

(Empty)

PROMPTMESSAGE="Please select the date/time"

The message that should appear along with the date/time prompt dialog box during runtime. This is useful in providing the user proper instructions (Example: Please select the date/time). This parameter is available only if the Action parameter is set to Prompt user.

Prompt Type

Text (options)

No

Prompt for date and time

PROMPTTYPE="date"

Specifies whether the prompt dialog box should prompt for the date, the time, or both. The available options are:

  • Prompt for date and time: The user will be prompted for both the date and the time. A date/time calendar will appear allowing the user to select a specific date and time.

  • Prompt for time only: The user will be prompted for the time only. A time calendar will appear allowing the user to select a specific time.

  • Prompt for date only: The user will be prompted for the date only. A date calendar will appear allowing the user to select a specific date.

Adjust Year

Number

No

0

ADJUSTYEAR="-4"

Specifies the number of years the date should be adjusted by. A positive or negative number may be used (Example: entering "4" indicates plus 4 years, entering "-4" indicates minus 4 years).

Adjust Hour

Number

No

0

ADJUSTHOUR="4"

Specifies the number of hours the date should be adjusted by. A positive or negative number may be used (Example: entering "4" indicates plus 4 hours, entering "-4" indicates minus 4 hours).

Adjust Month

Number

No

0

ADJUSTMONTH="4"

Specifies the number of months the date should be adjusted by. A positive or negative number may be used (Example: entering "4" indicates plus 4 months, entering "-4" indicates minus 4 months).

Adjust Minute

Number

No

0

ADJUSTMINUTE="-5"

Specifies the number of minutes the date should be adjusted by. A positive or negative number may be used (Example: entering "4" indicates plus 4 minutes, entering "-4" indicates minus 4 minutes).

Adjust Day

Number

No

0

ADJUSTDAY="-4"

Specifies the number of days the date should be adjusted by. A positive or negative number may be used (Example: entering "4" indicates plus 4 days, entering "-4" indicates minus 4 days).

Adjust Second

Number

No

0

ADJUSTSECOND="-30"

Specifies the number of seconds the date should be adjusted by. A positive or negative number may be used (Example: entering "30" indicates plus 30 seconds, entering "-30" indicates minus 30 seconds).