Date & Time to String: Format Guide

Used to set the format of the output string.

Example: Date & Time to String(value: 26th Nov 2021, 16:00:00, format: "YY-MM-DD hht") = "21-11-26 04PM".

Tip: You can combine as many placeholders together and add other characters, such as underscores (_), slashes (/), and similar.

Placeholder

Example

Description

YYYY

2021

Year in full.

YY

21

Last 2 digits of the year.

MMMM

January

Month in full.

MMM

Jan

Month in short format.

MM

01

Month number with a leading zero.

M

1

Month number wihout a leading zero.

DD

09

Day number with a leading zero.

D

9

Day number without a leading zero.

YD

231

Day of the year.

hh

03

Hours in 12-hour format with a leading zero.

h

3

Hours in 12-hour format without a leading zero.

HH

15

Hours in 24-hour format.

mm

05

Minutes with a leading zero.

m

5

Minutes without a leading zero.

ss

06

Seconds with a leading zero.

s

6

Seconds without a leading zero.

t

AM/PM

Time of day.

z

+06

Timezone in short format.

Z

+06:00

Timezone in full.

W

Monday

Day of week in full.

w

Mon

Day of week in short format.

YW

44

Week number.

ms

15

Milliseconds.

mcs

150

Microseconds.

ns

150

Nanoseconds.

Last updated