Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How can get 'Z' in time format?

Avatar

Level 8

Hello

With the below code, am getting current date and time, fine

 

 

var date = new Date();

 

time = date.getHours();

 

time = time + ":" + date.getMinutes() + ":" + date.getSeconds()

I am getting the output as below,

16:3:24

But, i want like below

16:03:24 EST ......I mean, i need the below enhancements

1) Minutes should come with PREFIX ZERO if minutes are lesss than 10

2) Most importanlty, i need DAY LIGHT ZONE, like Eastern Time, Central time, Pacific time etc.

Pls. let me know in JavaScript?

Thank you

0 Replies

Avatar

Level 6

var date = new Date();

this.rawValue = date.toTimeString();