Getting difference between GMT time and Local time

Folks,
I am trying to get difference between gmt time and local time for Korea time zone.
which should be 9 hours.
Instead of 9, I am getting 15 hours diff.
What am I doing wrong?
Here's what I did to test it:
First I set the system (Windows XP) time zone to Soul (Korea GMT+9hours) time zone.
Then I ran the following program, and I got 15 hour diff, not 9.
Thank you in advance!
import java.util.*;
public class Using_GregorianCalendar
     public static void main(String args[])
          Using_GregorianCalendar ugc = new Using_GregorianCalendar();
          ugc.getTimeDiff();
     public void getTimeDiff()
          Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
          Calendar cal1 = new GregorianCalendar(cal.get(Calendar.YEAR),
                                       cal.get(Calendar.MONTH),
                                       cal.get(Calendar.DATE),
                                       cal.get(Calendar.HOUR_OF_DAY),
                                       cal.get(Calendar.MINUTE),
                                                  cal.get(Calendar.SECOND));
        int gmtHour          =  cal.get(Calendar.HOUR); //(Calendar.HOUR_OF_DAY);
        int gmtHourOfDay =  cal.get(Calendar.HOUR_OF_DAY);
        int gmtMonth        =  cal.get(Calendar.MONTH);
        int gmtYear          =  cal.get(Calendar.YEAR);
        int gmtMinute       =  cal.get(Calendar.MINUTE);
        int gmtSecond     =   cal.get(Calendar.SECOND);
        int gmtDate         = cal.get(Calendar.DATE);
        Calendar localCal  = Calendar.getInstance();
        int localHourOfDay = localCal.get(Calendar.HOUR_OF_DAY);
        int timeDiff = (localHourOfDay - gmtHourOfDay);
          //Korea time is GMT + 9 hours so I should get a difference of 9
          //why am I getting difference of 15?
             System.out.println("************** in getTimeDiff() **********************");
          System.out.println("gmtDate: "+gmtDate);
          System.out.println("gmtHour: "+gmtHour);
          System.out.println("gmtHourOfDay: "+gmtHourOfDay);
          System.out.println("localHourOfDay: "+localHourOfDay);
          System.out.println("timeDiff: "+timeDiff);
          System.out.println("**********************************************************");
     }//getTimeDiff()
}//class Using_GregorianCalendar
/*              here's the output of this program:
     ************** in getTimeInGMT() **********************
     gmtDate: 14
     gmtHour: 6
     gmtHourOfDay: 18
     localHourOfDay: 3
     timeDiff: -15
*/

DrClap wrote:
sabre150 wrote:
Nearly correct since the Daylight saving may or may not be in effect which does depend on the date...I would simplify that to this:
TimeZone korea = TimeZone.getTimeZone("Asia/Seoul");
long delta = korea.getOffset(new Date().getTime());
System.out.println(delta / (1000.0 * 60 * 60));That's assuming that the OP really meant UTC when he/she said "GMT". Most people don't realize there's a distinction and that Java's timezones are all based relative to UTC.I suspect you are right in assuming that the OP want UTC and not GMT. I figured it was better to illustrate that the method can be used for getting the time difference between any two TimeZones.

Similar Messages

  • Difference between DB CPU and DB Time

    Hi,
    What is the difference between DB CPU and DB TIME in AWR report?
    Br,
    Raj

    Hi,
    Thanks for your valuable reply.
    1,DB CPU is time spent on CPU. It means only ACTIVELY working on CPU. WAIT TIME is not includeed.
    In 10 Minute interval with four CPU, Is the Maximum DB CPU 40 Minutes?
    2,I read the below document about DB time. http://www.perfvision.com/docs/JB_AAS.pdf
    I unable to understand at page 6.
    It says that DB Time = Includes CPU Time + IO Time +  Wait Time
    I understand about Wait time.
    CPU also involved  to do I/O Time? Is it RIGHT?.Hence, Why did seperate CPU Time and I/O time in the document?What is the purpose of it?
    Is it possbile to further divided the CPU TIME ? Like parse etc.....Which view provide it?
    3,If you had four sessions actively working or actively waiting 100% of the time in that 10 minute period, then your DB time would be 40 minutes.
    In a given interval,Where can i find NON Idle wait time in AWR?
    Plese help me out it
    Br,
    Raj

  • DIFFERENCES between BASIC SCHEDULING and LEAD-TIME SCHEDULING.

    Hello SAP Gurus,
    Kindly let me know the differences between BASIC SCHEDULING and LEAD-TIME SCHEDULING.
    Looking for your early feedback.
    Warm regards,
    Kaushik.

    Hi,
    Basic scheduling :
    1.Basic dates are calculated.
    2.Exact to day.
    3.No cap reqmts are generated.
    4.uses the inhouse production time from material master.
    5.carried out automatically during planning run.
    In basic date calculation ( order start date/ order finish date ) the system always
    calculates backward scheduling.
    1. From the reqmts date the system subtracts the GR processing time to
    calculate the order fininsh date.
    2. From the order finish date the system subtracts the inhouse production time to calculate the order start date.
    3. From the order start date the system subtracts the opening period given in scheduling margin key to calculate the order opening date.
    Lead time scheduling :
    1.Exact to second
    2.ie production start date /time and finish date and time are calculated.
    3. cap reqmts are generated.
    4. uses times from routing.
    5. carried out only if the scheduling mode in MD02 screen is kept with indicator 2.
    From the order finish date the system subtracts the float after production to calculate the production finish date.
    From the production finish date the individual operations in the routing are scheduled backwards to calculate production start date.
    From the production start date the system subtracts the float before production
    to calculate order start date.
    Regards,
    nandha

  • Difference between Spilt Mac and Local Mac architecture

    Hi,
    Can someone explain to me the difference between Split mac and Local Mac architecture.
    And of course if you have some documentation on it, I'll take with pleasure.
    Thank you.
    Jonathan.

    http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_9-3/wireless_lan_switches.html
    Two types of MAC implementations are possible with Fit APs, known as the Local MAC and the Split MAC architectures. Local MAC is where all the wireless MAC functions are performed at the AP. The  complete 802.11 MAC functions, including management and control frame  processing, are resident on the APs. These functions include time-sensitive functions (also  known as Real Time MAC functions).
    The Split MAC architecture divides the implementation of the  MAC functions between the AP and the controller. The real-time MAC  functions include functions such as beacon generation, probe transmission and  response, control frame processing (for example Request to Send and Clear to        Send—RTS and CTS), retransmission, and so on. The non-real  time functions include authentication and deauthentication; association  and reassociation; bridging between Ethernet and Wireless LAN; fragmentation; and so  on.
    Vendors differ in the type of functions that are split between  the AP and the controller, and in some cases, even about what  constitutes real time. One common implementation of a Fit AP involves local MAC at the AP and  control and management functions at the AP.
    split mac
    http://www.cisco.com/en/US/docs/solutions/Enterprise/Mobility/emob30dg/TechArch.html#wp999574
    CAPWAP Protocol
    http://www.cse.wustl.edu/~jain/cse574-10/ftp/capwap/index.html

  • Server Time and Local Time (Dreamweaver) Off By 1 Hour

    How can I get Dreamweaver to show me the correct time stamp on my files on the server and my local machine? When I telnet into my server, the date and time stamp on all files is correct. My server time is set properly to ET (GMT-5). My local machine's time is properly set. I asked my sysadmin if PureFTP has any timezone settings and I was told by the sysadmin that all my server times and timezones are accurate. My sysadmin said that Drwamweaver is the culprit.
    I have lived with this for a long time, but it is extremely annoying and I would like to fix it.
    I searched high and low in the Dreamweaver option settings for some sort of timezone setting or offset -- found nothing.
    Has anyone experienced a 1-hour out-of-sync issue between a file's actual time stamp on the server and what Dreamweaver shows it as in the Remote/Local Files View?
    Thanks.

    During Daylight Savings Time.
    http://forums.adobe.com/message/3545349#3545349
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • System Time and Local Time

    Hi all,
    Our system are config to have a different time zone with the system time. Just wondering what type of fields will take the local time and which type will take system time. We found that dates like document date/time will take local time but created by date/time will take system time. Why is this so?
    We know that for job scheduling will run at system time. Is there a way to let the system know to run at the local time? Users find it very troublesome to adjust the timing.
    Rewards will be given to useful answers. Many thanks.
    Regards,
    Janet

    Hi,
    I found this info in one of the SAP sites i found this may be useful to you.
    The easiest way to prevent any time zone problems is to run everything with UTC (formerly GMT - Greenwich Mean Time). But while it’s a good idea for servers, end users will most likely complain about being confused (my family doesn’t - my home systems are on UTC to prevent the hassles with summer/winter time). And if you implement SAP using local time on the server, while your users are in different time zones, things can get slightly complicated. Just try searching in OSS with search term “sy-timlo”.
    The main problem is that some fields in SAP are stored as server local time (and date), while others use user’s local time. In general, as SAP explains in many OSS notes, any date/time that is written by the system is server local time, and any date/time that can be manually entered by users is in respective user’s time zone. To help us even more, the time zone used is not stored in documents, but only in user profile, so to be really sure which time is meant, one has to find the user who did the data entry or update, and then find the time zone and do conversion if necessary. SAP gives a good example in OSS note 636992. There, a user sitting in Japan creates a notification about, for example, machine breakdown, entering local time. Several hours later, a colleague in Germany looks at the notification and thinks that the machine has been down only a few moments, while it’s actually several hours!
    Things are enough confusing if you are analysing some problem by looking at the data. And if you are creating documents (material movements, accounting postings or production order confirmations) from ABAP programs with, for example, BAPI functions, you have to be especially careful because the system will run checks on date and time fields, with different logic. In general, the posting date (BUDAT or, as in BAPIs, POSTG_DATE) and several date/time fields like EXEC_START_DATE, EXEC_START_TIME, EXEC_FIN_DATE, EXEC_FIN_TIME, EX_CREATED_DATE/TIME in confirmations in the BAPI function BAPI_PRODORDCONF_CREATE_TT are your local date and time. While creating order confirmations, the system will check the date/time against the user local date and time and will prevent creating confirmations in the future. In contrast to PP, the BAPI to create a goods movement - BAPI_GOODSMVT_CREATE - assumes that posting date is a local date, but doesn’t complain if it’s in the future. The potential problems can be hard to find and detect: if you have small time differences, the posting date can differ only during one-two hours per date - only then you will get an error when posting an order confirmation. For all those fields mentioned above you should normally use the system fields SY-DATLO and SY-TIMLO if they have to be populated with current date and time. If the data is provided by an external system, then either the system has to care about the correct time, or your ABAP program has to do time zone conversion.
    In certain situations you can assume that if a document is being created for some plant, then the current server time can be converted into local time of the plant, if you know the time zones of both. The server’s time zone, or more exactly, its difference with UTC, can be found in the system variable SY-TZONE. To find the time zone of a plant, you can use the logic that can be found in the function CO_R0_SET_LOCAL_DATE_AND_TIME.

  • WIP database central time and local time questions

    Hi,
    I have mission to develop some reports which has to point to the WIP database, as far as I know, the WIP data time is stored as the central timestamp, but our usr is accepted only with local time. As we have several sties in US with different timezone, so it is a little confusing to me how to make my report be able to recongize the correct local time simply.
    In SAP ME internal report, I search some SFC information, it always can display the correct local date time, I am interested to know how SAPME works like thi, if possible, can anyone share this method to me? or give me some good idea how I can handle this?
    Thanks a lot and best regards,
    Leon Lu

    Hi,
    In most cases ME grabs timezone associated with site (Site Maintenance). Some reports though might use client's locale from browser to make conversion.
    Thanks,
    Bakhtiyar

  • What is the difference between an archive and a time machine backup?

    I would like to save a lot of video to an external hard drive and have the drive fill up until it is full and then I'll use another drive to continue to save video.  I do not want to backup my entire hd on my mac, just the video.  Then when I want to access the video I want to be able to fetch it off the external drive and view/edit it in imovie.
    How do I do that?

    If you want the videos directly available to iMovie, do the move within iMovie.
    Open the Event Library if it is not already, then click on the Hard Drive icon (highlighted in blue on the screen shot).
    Then drag your events from the iMovie Events that are under your Macintosh HD onto your external hard drive in the Event Library list. There is some more information in the iMovie Help, under Lesson 7, for organizing your event library.
    When you import video from a camera, you can choose to store it on the external hard drive instead of the internal.
    Be careful not to select the external hard drive when you are looking for clips. Nothing bad will happen, but iMovie will load all of the video on the drive into the clip window. That takes a bit of time if the drive is full.
    Now, you should back up that external in some way since you don't want to lose all your video if the drive crashes. I have been considering a RAID setup with mirrored drives, but I haven't looked that deeply into the idea. Right now, I just copied from one drive to the another as a stopgap solution until I implement a better, incremental backup system.

  • Dw cs5 FLV video quality difference between web play and local play w/same flv file

    When I play a flv locally on my pc with adobe media player.. it looks great.
    i build a page, insert it in the page (dw cs5) use auto size detect. upload all..
    then go to test it out using FF and the video is not a sharp ( the text titles are especially ratty looking  http://www.centroidcnc.com/cncvideo/centroid_digitizing_cs5.html ).
    how can this be? its the same file.  what am i doing wrong? thanks in advance for any tips.
    here is a screen capture of the 480 wide flv playing in adobe media player... reasonable text clarity
    and the same file playing in firefox.. with rattly looking text.
    is the browser trying to scale it up or something?

    Test page looks pretty good but you still have dimension problems.... notice the black bars on the side of the video. Black bars on the sides mean the height is not great enough. Because that version of the player has the controls below the video, you have to ADD that number of pixels to the height.
    height: 360, width: 480
    so width needs to be video height (360) PLUS height of controls ...15 or 20 or so... may need the trial and error thing again.
    The JW Player will play mp4s on the iPhone.
    I'd suggest using QuickTime Pro to convert. QT Pro has an excellent "Export for Web" option that exports beautiful video (m4v).
    QT will open many file types but if you only have the .flv version, you can use Handbrake to convert to .mov or .mp4:
    http://handbrake.fr/
    It's free and does a pretty good job. But I still do the final convertion with QT because the finish video comes out so nice.
    For example:
    http://exploreolympics.com/reports/?p=3499
    videos play in iPhone as well as PCs (JW Player with controls over video)
    Check for other/newer version of player with controls over video.
    Of course JW Player is just one of many media players available. FlowPlayer is another:
    http://flowplayer.org/
    or get a Flash developer to create one for you... as on the Home page here:
    http://www.exploreolympics.com/index.html
    This page uses our custom Flash player with fallback to the JW PLayer (using swfobject).
    So there are many solutions to your problem, but the reason the text is fuzzy is that the video dimensions are not correct.
    Best wishes,
    Adninjastrator

  • Exchange Rate difference between PO , GR and IR

    Hi All,
    I have a question, Does anyone know how to handle the PO exchange rate difference between PO , GR and IR time.
    For example
    1.  PO creation on Jan 2009  - exchange rate = 1.2
    2.  GR creation on Feb 2009 - exchange rate = 1.5
    3.  IR  creation on March 2009 - exchange rate = 1.7
    Should GR and IR use the PO exchange rate # 1 for posting or use the current exchange # 2 for GR and #3 for IR ?
    Thank you
    Alex

    Hi Alex,
    The exchange rates in PO and GR and IR will be different as if you have are updating the rates per month in system so it will changed.
    Regards,
    Ninad Kshirsagar

  • Difference between current row and previous row in a table

    Hi All,
    I am having a problem with the query. Can some of please help me?
    I need to get difference between current row and previous row in a table. I have a table, which have data like bellow.
    TABLEX
    ================
    Name Date Items
    AAA 01-SEP-09 100
    BBB 02-SEP-09 101
    CCC 03-SEP-09 200
    DDD 04-SEP-09 200
    EEE 05-SEP-09 400
    Now I need to get output like bellow...
    Name Date Items Diff-Items
    AAA 01-SEP-09 100 0
    BBB 02-SEP-09 101 1
    CCC 03-SEP-09 200 99
    DDD 04-SEP-09 200 0
    EEE 05-SEP-09 400 200
    Can some one help me to write a query to get above results?
    Please let me know if you need more information.
    Thanks a lot in advance.
    We are using Oracle10G(10.2.0.1.0).
    Thanks
    Asif

         , nvl (items - lag (items) over (order by dt), 0)like in
    SQL> with test as
      2  (
      3  select 'AAA' name, to_date('01-SEP-09', 'dd-MON-rr') dt,  100 items from dual union all
      4  select 'BBB' name, to_date('02-SEP-09', 'dd-MON-rr') dt,  101 items from dual union all
      5  select 'CCC' name, to_date('03-SEP-09', 'dd-MON-rr') dt,  200 items from dual union all
      6  select 'DDD' name, to_date('04-SEP-09', 'dd-MON-rr') dt,  200 items from dual union all
      7  select 'EEE' name, to_date('05-SEP-09', 'dd-MON-rr') dt,  400 items from dual
      8  )
      9  select name
    10       , dt
    11       , items
    12       , nvl (items - lag (items) over (order by dt), 0)
    13    from test
    14  ;
    NAM DT             ITEMS NVL(ITEMS-LAG(ITEMS)OVER(ORDERBYDT),0)
    AAA 01-SEP-09        100                                      0
    BBB 02-SEP-09        101                                      1
    CCC 03-SEP-09        200                                     99
    DDD 04-SEP-09        200                                      0
    EEE 05-SEP-09        400                                    200
    SQL>

  • There is difference between Total vat  and vat as per trail balance

    Dear Gurus,
               I am getting difference between vat payble and vat as per trail balnce,i am attaching below  file.
                   Dr      Cr     Net Balance     VAT Rate     
    410000          SALES - HANDSET     249,500.47     162,055,133.33      161,805,632.86      4%     
    410001          SALES - VODATA     93,422.47     4,897,111.40      4,803,688.93      4%     
    410002          SALES - KITS/CARDS/A     1,389.60     1,391.43      1.83      4%     
    410004          SALES - OTHERS     143.27     562,801.74      562,658.47      4%     
    410005          SALES - FWP          2,597,821.94      2,597,821.94      4%     
    410007          SALES - T SKY     2,665.78     34,655.14      31,989.36      12.50%     
    410051          SALES RET - HANDSETS     271,951.50           (271,951.50)     4%     
    410052          SALES RET - VODATA     3,701.92           (3,701.92)     4%     
                              169,526,139.97           
              Less : Additional Trade discount               960,165.57          
              Net Sale               168,565,974.4          
              VAT @ 4%                6,741,359.40
              VAT @ 12.5%               3998.67
              Total VAT                6,745,358.07
              VAT as per Trial                6,696,095.39
                   Difference           49,262.68

    Hi,
       How to i will check zero vat entries for the revenue G/L accounts,could u give me T.code and example.

  • I do video productions for a small local TV station. I use Final Cut Express to edit. I need a new video camera but am at a loss as to what to buy. I know I will get a digital camera but do not know the difference between just digital and digital HD.

    I do video productions for a small local TV station. I use Final Cut Express to edit. I need a new video camera but am at a loss as to what to buy. I know I will get a digital camera but do not know the difference between just digital and digital HD. Also, I can not afford an expensive camera and need some advice on which of the available cameras would be best and also work well with a Mac. One last issue, I currently use a Panasonic #CCD camera that takes a tape. When I load video to Final Cut the audio and video are out of sinc. Go figure. Can anyone help with these questions. Karen

    Hello Karen,
    If you are using Final Cut Express, then look for camcorders that are AVCHD camcorders.  Look especially for the AVCHD logo and specific mention of AVCHD in the specs.  Most of the major manufacturers produce good quality camdcorders - Canon, Sony, etc.
    Also, be aware that there are a lot of "not quite AVCHD" camcorders on the market (sometimes they say they record video as MPEG4-H.264/AVC) - buyer beware!
    Most everything you are going to find on the market today is HD, which stands for "high-def".
    Regarding your question about the Panasonic camcorder, it's best if you post that as a separate question, and please identify the specific model camcorder and the Easy Setup you are using in FCE.

  • Difference between Req with insufficient lead time and lead time const

    Hi ,
    1) Can anyone explain the difference between Requirement with insufficient lead time and Requirement lead time constraint exception messages. Both seems to be similar for me with the compressed time.Also at what situations these exceptions are generated.
    2) what is minimum lead time required ,actual lead time and its calculation.
    Thanks...

    Check out
    http://help.sap.com/saphelp_scm50/helpdata/en/99/ed3a981d0f11d5b3fc0050dadf0791/content.htm
    particularly the section "Which functions of the operations relevant to scheduling are supported?"
    It will give you a flavour of what can lead to difference in planning.

  • Difference between Bucket capacity and Time continuous capacity

    Can somebody explain the difference in functionality between "Bucket capacity" and "Time continuous capacity" as used in field "Finite capacity" in "PP/DS bucket capacity"  tab in Resource?
    How will above above two settings work when you have "Block planning" in  "Bucket definition" tab in same tab?
    Thanks,
    Srini

    Hello,
    The difference between Bucket capacity and Time continuous capacity are:
    Time continuous capacity is basically the capacity which is infinite continuous duration in time and you can define the shift intervals and breaks to adjust as per business process e.g. everyday 8 hrs or 16 hrs capacity with lunch time and breaks in between whereas bucket capacity is a discrete capacity and is specified bucket wise. Bucket capacity can be in PPDS as well as SNP. In PPDS it is used specifically for CDP planning or block planning. In SNP it can be used for bucket capacity references as Transport resources, storage resources , bucket planning etc
    With respect to Block Planning:
    You maintain the blocks using the entire validity of the available capacity of the resource. If you defined buckets from block planning for validity periods in which no blocks are defined, the buckets correspond to technical intervals in which the system schedules on a time-continuous basis.
    You  can check out the below link for the Block planning with Bucket capacity:
    http://help.sap.com/saphelp_scm41/helpdata/en/e5/90bb3b6070bf38e10000000a11402f/content.htm
    Hope the information is useful
    Regards

Maybe you are looking for

  • Error in J1IIN

    Dear SAP Experts, I have made a new sales document types for our new launch product, for example - ABCD (Contract) - ACCD (Sales Order) - LF - AFSB (Billing) - j1iin. I have done required configuration for the same. when i made sales order to billing

  • Select Query optimisation

    Hi. Is there any way to optimise the below code. or can i write a join query for this if yes then how.   SELECT land1          zone1     FROM tzone     INTO CORRESPONDING FIELDS OF TABLE t_land     FOR ALL ENTRIES IN int_delivery     WHERE zone1 = in

  • Cannot launch application to open a file from jdev extension

    Hello: I use the following code to let my application to open a file: String[] cmd = new String[3]; cmd[0] = "cmd.exe" ; cmd[1] = "/C" ; cmd[2] = "myfile.pdf; Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); It worked fine if it was in a main

  • DTO with attributes having public access.

    Hi In my application I'm using Data Trandfer Objects for trasfering data between client and server. It's only used for travfering data and as a client side buffer. Shall I keep all the attributes with public access specifiers?Is it against any concep

  • How do I make a shortcut for a folder without duplicating the contents?

    With Windows, I can right-click and make a shortcut icon for a program or folder, but don't know how to do that with a Macbook. I'd like to create a link in my Public folder for my music. Thanks for any help.