Android Question TimeZone Offset Help

walterf25

Expert
Licensed User
Longtime User
Hello all, i need some help with implementing timeoffset. I'm working on an app that will be used in different timezones, the app will communicate with a server and the server will send a response with the current timezone, i'm using Erel's DateUtils library and so far it works very good, i'am using.

B4X:
DateUtils.SetDateAndTime(year, month, day, hour, min, secs, timezone)

this works great with an offset of -5, -7, +5 but what about if the offset is +5:30, how can i use this with this code, since the timezone parameter has to be an integer?

Any suggestions?

Thanks,
Walter
 

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
From the DateUtils documentation:
'Returns the ticks value of the given date and time with the specified time zone offset.
'The last parameter is the time zone offset measured in hours.
PublicSub SetDateAndTime2(Years AsInt, Months AsInt, Days AsInt, Hours AsInt, Minutes AsInt, Seconds AsInt, _
TimeZone AsDouble) AsLong

For 5:30 I'd supply 5.5 as the TimeZone.

- Richard
 
Last edited:
Upvote 0
Top