×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Mar 2010
    Location
    Zaandam, Holland
    Posts
    71

    Question Getting GMT, or Timezone offset to GMT

    Are there any easy ways to get a phones offset to GMT without touching a server and finding its offset that way?

    I need all collected data to be in-line with timestamps, without any hiccups when changing timezone.

    Thanks (:

    [Edit]: I forgot to mention dateObj.getTimeZoneOffset() doesnt seem to work on the devices. (N97 & Mini)
    Last edited by JasperGoes; 2010-04-15 at 11:11.

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Getting GMT, or Timezone offset to GMT

    Is there some special situation where getTimezoneOffset fails?

    getTimezoneOffset returns the offset in minutes in a quite fancy way e.g. you will get -180 for GMT+3
    http://www.w3schools.com/jsref/jsref...zoneOffset.asp

    Code:
    var date = new Date()
    var inhours = -date.getTimezoneOffset()/60;
    alert("The local time zone is: GMT " + inhours);
    Tested with N97 mini

    -Ilkka

Similar Threads

  1. Cannot run streaming through a J2ME code on WTK2.5.2.
    By itismohit in forum Streaming and Video
    Replies: 0
    Last Post: 2009-03-30, 07:49
  2. FATAL ERROR - Applet 17 with certain png's
    By OneNineStudios in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2008-12-17, 13:11
  3. How to set timezone offset in S60 3rd
    By yaohongwang in forum Symbian
    Replies: 3
    Last Post: 2008-07-09, 15:03
  4. TimeZone , Network and 6600
    By judyj2x in forum Mobile Java General
    Replies: 2
    Last Post: 2004-05-27, 16:01
  5. How to get a current time with TimeZone offset
    By ratl in forum Mobile Java General
    Replies: 0
    Last Post: 2002-05-16, 05:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×