Support Topics Documentation Slack YouTube Blog

Get data from date


(Evgeny Tishkin) #1

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?


(Vladimir Upirov) #2

Hi Evgeny

According to “month” the method returns value between 0 and 11, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth#Syntax
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


(Evgeny Tishkin) #3

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