Get your 6-month No-Cost Opt-Out offer for Unlimited software automation!

Method Common.GetFormattedDateValue

Converts current DateTime string into new Formated DateTime string. See all available formats below.

Usage

Function ZAP.Common.GetFormattedDateValue ( 
  String DateString,
  String NewFormat,
  String OriginalFormat [Optional],
  Boolean Report [Optional]
)

Parameters

DateString

Type: String

Input DateTime string. Keep "current" or an empty string for getting the current date and time, "UTC" for UTC time.

NewFormat

Type: String

New format, example: "MM/dd/yyyy". See all available formats.

OriginalFormat (optional)

Type: String

Default value: Empty string

Original specific format, example: "MM/dd/yyyy". See all available formats.

Report (optional)

Type: Boolean

Default Value: False

Generate report for this step

Available formats:

d

Represents the day of the month as a number from 1 through 31.

dd

Represents the day of the month as a number from 01 through 31.

ddd

Represents the abbreviated name of the day (Mon, Tues, Wed etc).

dddd

Represents the full name of the day (Monday, Tuesday etc).

h

12-hour clock hour (e.g. 4).

hh

12-hour clock, with a leading 0 (e.g. 06)

H

24-hour clock hour (e.g. 15)

HH

24-hour clock hour, with a leading 0 (e.g. 22)

m

Minutes

mm

Minutes with a leading zero

M

Month number (eg.3)

MM

Month number with leading zero (eg.04)

MMM

Abbreviated Month Name (e.g. Dec)

MMMM

Full month name (e.g. December)

s

Seconds

ss

Second with leading zero

t

Abbreviated AM / PM (e.g. A or P)

tt

AM / PM (e.g. AM or PM

y

Year, no leading zero (e.g. 2015 would be 15)

yy

Year, leadin zero (e.g. 2015 would be 015)

yyy

Year, (e.g. 2015)

yyyy

Year, (e.g. 2015)

Returns

New Formatted DateTime string

Example

VBScript

' input time
t1 = Zap.Common.GetFormattedDateValue("05/10/2017", "MMMM")
msgbox(t1) ' => May
' Current Time
t2 = Zap.Common.GetFormattedDateValue("current", "MM")
msgbox(t2) ' => current month (ex. 04)
' Complex format, add result to report
t3 = Zap.Common.GetFormattedDateValue("2019,05,31", "dd", "yyyy,MM,dd", True)
msgbox(t3) ' => 31

JavaScript

// input time
var t1 = Zap.Common.GetFormattedDateValue("05/10/2017", "MMMM");
alert(t1); // => May
// Current Time
var t2 = Zap.Common.GetFormattedDateValue("current", "MM");
alert(t2); // => current month (ex. 04);
// Complex format, add result to report
var t3 = Zap.Common.GetFormattedDateValue("2019,05,31", "dd", "yyyy,MM,dd", true);
alert(t3); // => 31;

Documentation Categories

ZAPTEST

FARM

LOAD