common, namespace, get, formatted, date, value, convert, scriptless, script-less, scripted, step, view, stepview

Method Zap.Common.GetFormattedDateValue

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

Watch this video to learn how to use this method

Have a problem with playback?

Usage

Function Zap.Common.GetFormattedDateValue ( 
	String DateString,
	String NewFormat,
	String OriginalFormat [Optional]
)

ZAP Utility

Zap...DateValue

01-01-2019

yyyy/MM/dd

MM-dd-yyyy

newDate

DateString

NewFormat

OriginalFormat

Output Parameter

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.

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
t3 = Zap.Common.GetFormattedDateValue("2019,05,31", "dd", "yyyy,MM,dd")
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
var t3 = Zap.Common.GetFormattedDateValue("2019,05,31", "dd", "yyyy,MM,dd");
alert(t3); // => 31;

Comment

Convert DateTime to "yyyy/MM/dd" format and save it to local variable

ZAP Utility

Zap...DateValue

01-01-2019

yyyy/MM/dd

MM-dd-yyyy

newDate

Contact Us

Tower Place 100

3340 Peachtree Rd NE #1800 

Atlanta, GA 30326 USA

(404) 814-5227