Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 368
Registered: ‎06-30-2012
My Device: Playbook, Z10LE, DevAlpha C
My Carrier: Telenor, Mobitel
Accepted Solution

Getting Time Zone from device

[ Edited ]

I'm trying to get current timezone from device.

I found in documentation that they are in CalendarSettings class (method currentSystemTimezone()) and CalendarSettings should be retrieved vie settings method in CalendarService. I cannot found any sample how to do this, looked in calendar sample, even modify it to get timezone, but without success. 

Anyone knows working sample for this?

 

Thx

Developer
Posts: 368
Registered: ‎06-30-2012
My Device: Playbook, Z10LE, DevAlpha C
My Carrier: Telenor, Mobitel

Re: Getting Time Zone from device

I manage to do this, but with javascript in QML . If anyone is interested this code will return difference to GMT time in minutes 

 

var date = new Date;
var gmtMinutesOfset = date.getTimezoneOffset();

 

Highlighted
Developer
Posts: 34
Registered: ‎06-19-2012
My Device: BlackBerry Z10 Ltd Edition
My Carrier: giffgaff

Re: Getting Time Zone from device

I'm trying to get an instance of CalendarService (to check 12/24 hour clock setting), but can't:

 

undefined reference to `bb::pim::calendar::CalendarSettings::~CalendarSettings()'

 

I've tried a variety of ways of getting a CalendarService and calling settings() on it, but it all boils down to the above or variants of it.

__________________
Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org
Developer
Posts: 34
Registered: ‎06-19-2012
My Device: BlackBerry Z10 Ltd Edition
My Carrier: giffgaff

Re: Getting Time Zone from device

Oh, mine was as simple as missing, from my .pro file:

 

LIBS += -lbbpim
__________________
Andrew Flegg -- mailto:andrew@bleb.org | http://www.bleb.org