Get data from date

Hello!

I want to get data from the date: month, day, hour, and minute. But when I print out the data, the month and day are not correct. Why?

And how to get time in the right time zone?

Hi Evgeny

According to “month” the method returns value between 0 and 11, Date.prototype.getMonth() - JavaScript | MDN
so if you would like to have it from 1 to 12, you have to add Đ° block to increase by 1

according to “day”, the method returns the day of the week and it’s also starts from 0 to 6

So, you need to use “date” option

According to time zone: you need to pass client time zone to the server and offset your date on the server, in my case I have time zone “+1” so I need to offset currentDate value to one hour, it’s 3600 seconds, in your case (+3) and it must be 3*3600 = 10800 seconds

Regards, Vlad

1 Like

Yes Vlad, that’s right! Thank you very much!)