can anyone tell me which nlapi command to use to g...
# suitescript
m
can anyone tell me which nlapi command to use to get the user's timezone from server. I have tried nlapiStringToDate( nlapiDateToString(new Date() , 'datetimetz'),'(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna') but I am not able to get the actual time of the selected timezone
n
Don't know your use case or even what you are trying to do Old School Vanilla new Date() should give you the user Date and Time in the Client script. But it will give you the Server TimeZone in server-side script,
If you already know the timezone of the user and want to exploit that and get the Date and time of that timezone, there are a number of ways
m
@Nik could you share atleast a way where I can get the date and time of the selected dealer because I have the timezone with me
n
In what format do you have timezone?
Btw, thi will not include any API, should be js or a a js library function
m
I have the ids of the timezone record
n
Do you have offsets? Like for Pacific, it should be +8 or + 7 depending upon daylight savings or standard or do you have the INTL/IANA format like "America/New_york"
I think you may want to go for moment.js/moment-timezone.js and handle the conversions. Worth a shot. Have look at their documentation and that will get you started. There are some cool questions related to moment.js on stackoverflow which may be of help to you. I did check them out initially when I started. Might give you a boost.