How can i work out the GMT time wherever i am ?

Hi, i'm going crazy with the date/time classes, just can't seem to work it out.
I need to know the current time as a GMT time.
I need to know wherever the program is running, i myself am in Amsterdam GMT+02:00 , my server is located in Canada GMT-04:00 (?)
I parse dates from websites all over the world so i get times in the form of strings of which i know the timezone. I need to store everything in a mysql database and i want the database to contain GMT times only.
I've worked out how to get a string from its timezone into GMT but,
how can i get the current time as GMT ?
somehow i keep getting timeshifts i cannot explain.
this is where i got to:
TimeZone tz_gmt;
tz_gmt = TimeZone.getTimeZone("GMT");
SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdformat.setTimeZone(tz_gmt);
Timestamp tsGmtnow;
tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
Which is fine if i run it in Amsterdam, it gives me the current date/time in GMT, but on the server in Canada it gives me GMT+4 hours. What am i missing ?

found a workaround,
     TimeZone tz_gmt;
     tz_gmt = TimeZone.getTimeZone("GMT");
     TimeZone tz_can;
     tz_can = TimeZone.getTimeZone("GMT-04:00");
     TimeZone tz = TimeZone.getDefault();
     String Stz = tz.getID();
     SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     Timestamp tsGmtnow;
if ( "Europe/Berlin".compareTo(Stz) == 0) {
     // i'm in Europe, go from local time to GMT
     sdformat.setTimeZone(tz_gmt);
     tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
} else {
     // i'm in Canada, local time IS gmt
     sdformat.setTimeZone(tz_can);
     tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
out.println(tsGmtnow.toString());
the default timezone returns either:
Europe/Canada
GMT-04:00
somehow the GMT-04:00 get ignored by the formatter

Similar Messages

  • How can i find out the last time a back up to icloud was done

    How can i find out the last time a back up was done to icloud?

    Go to Settings>iCloud>Storage & Backup.  It will be shown just below the Back Up Now button at the bottom.

  • How can I find out the overall time and not only the time of a single clip?

    I have set up two cameras in one room. Both cameras record the same thing from different perspectives at the same time. I have found an interesting scene for video 1 (recorded by camera 1). Now I would like to find the time at which the interesting scene takes place in video 2.
    However, I have not seen any way to get displayed, at what time the scene starts in relation to the total length of the video (e.g: scene starts after 5 minutes from total 10 minutes).
    The indicated time refers only to a part of the clip and not to the overall project, even if a special clip is not selected. Does anyone know, how I can find out the time?

    Go to Settings>iCloud>Storage & Backup.  It will be shown just below the Back Up Now button at the bottom.

  • HT1414 How can i find out the last time my iphone was restored?

    Hey, i need help on how to find out when the last few times my iphone was restored.
    Thanks

    This is a strange question, not sure where you are going with this one. On the computer you Restored with, iTunes requests to back up the iPhone. These are time stamped and stored on the computer. You can use iTunes to search the list of back ups of your iPhone and see the dates, so you can at least see the dates of the back ups.

  • How can I work out the I cloud

    How can I download the music
    How can I get the I cloud started
    Need to increase the speed of my cell the fastest processing unit required

    Music and other content from the store will only show if you are in a country where they can be redownloaded (and if they remain in the store). If you are in a country where you can redownload music purchases then you will have a Music category in the Purchased tab in the iTunes store app on your phone, and under the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage on your computer's iTunes
    There is some info on the cloud here : http://www.apple.com/icloud
    How to set up : http://www.apple.com/icloud/setup/
    Creating an iCloud account : http://support.apple.com/kb/HT4436

  • How can I work out the Total Uptime between two points?

    I need to find the TOTAL uptime between a certain date and now (need to separate for an electricity bill). Can someone help me with a script or something?
    Thanks

    I'm confused as to what you are looking for if uptime is not it. 
    I need to find out how long it has been powered on from the 6th August 2014 to now. Any ideas?
    If the system has been rebooted in that time then you might be able to go back into the log files and as Mark Jalbert wrote look for the times the system was shutdown and then booted and get a rough figure that way. But of course this requires that the log files since August are still available.
    Of course what the system was booted there is no guarantee all external peripherals were also on and when the system was shutdown there is no guarantee that all the peripherals were turned off so at best you are getting a rough estimate.

  • How can I close out the page I am working on in safari when error boxes keep popping up?

    How can I close out the page I am working on in safari when error boxes keep popping up?

    What do the error messages say ?

  • How can i find out the more than one times occurance of integer in a array?

    How can i find out the more than one occurance of integer in a array. Assume i have 2,2,3,4,2,5,4,5 in a Array and i need to find out the how many times of 2, 5 and 4 is exists in that array. Please some one help me as sson as possible. thanks in advance....

    Kumar_Mohan wrote:
    How can i find out the more than one occurance of integer in a array. Assume i have 2,2,3,4,2,5,4,5 in a Array and i need to find out the how many times of 2, 5 and 4 is exists in that array. Sort the array. Then loop through it and compare each i-th element with the (i+1)-th element.
    Please some one help me as sson as possible. thanks in advance....In future postings, please refrain from telling that it is urgent, or you need help ASAP. It is rather rude to do so.

  • How can i know if the face time is working on the iPad before i buy it?

    How can i know if the face time is working on the iPad before i buy it?

    I am plan to buy new ipad2 and i want to check before i buy it, if there is facetime or not?
    As far as i know if it is from KSA there is no face time in, but if it from US there is facetime in?
    And i have the serial number.

  • Help! How can I take out the mini-disc stuck in mac?

    Help! How can I take out the mini-disc stuck in mac?
    I insert it into the mac, but the OS cannot load the disc and the disc cannot be ejected even i pressed the "eject" button.

    This happened to a family members macbookpro. A mini-cd inserted, couldn't be mounted or ejected by the drive.
    I cut a rectangle from a cereal box about two inches wide and 6 inches long. Abour an inch and half from one end in the middle I cut a notch and bent it down a little.
    I................I
    I................I
    I....I__I....I
    I................I
    I................I
    I................I
    I................I
    I................I
    I................I
    I................I
    I................I
    I................I
    I________I
    I then inserted it slowly into the drive notch down and slowly pulled out. I did this few times and caught the mimi-cd and removed it. The drive has worked flawlessly for several years
    A few days after this happened I was in BestBuy and an Apple rep was there displaying new Apple products. I asked him about it and he said they have a tool that ***** it out.

  • How can I find out the dpi of an image in Acrobat.

    How can I find out the dpi of an image in Acrobat. I have tried the pre-flight option but I really don't understand the pixels width x depth information that I get. I basically just want to know at dpi of a single image. Is there other program that will read my pdf file and tell me this information.

    Thank you, tylerdurdain! That was ridiculously difficult to find. Not sure what version of Acrobat you're using in your image, but for those using Acrobat Pro 11 (in Mavericks), it's buried under View > Tools > Print Production.
    That opens a panel on the right.
    To keep from having to chase it down this way each time, right click on "Output Preview" and choose "Add to Quick Tools Toolbar". That adds a button to the top right of the toolbar.
    Now you can call up the inspector with one click. Choose Object Inspector as tylerdurdain shows above, then click on the item displayed to get its properties.

  • How can I find out the audio sampling rate of BetacamSP tape?

    Hi guys
    I'm trying to digitize BetacamSP tape. But I'm afraid if I might choose wrong setting...
    This tape is from very long time ago so we don't know which audio sampling rate we recorded with..
    How can I find out the audio sampling rate of this BetacamSP tape?
    Thanks:)

    The sampling rate is set by the Sony DVMCDA2 you are using, when the conversion is made from the analog input to the digital (DV) output. You should be outputting standard DV which is 16bit 48khz audio.
    Assuming you are in the US, your Easy Setup for FCP should be DV-NTSC, and then open the Log and Capture Pane and set the Capture Settings Device Control to Non-Controlable Device and you should be good to go.
    You will have to roll the deck manually and start and end your capture manually.
    You can download a user manual for the DVMCDA2 by clicking here.
    MtD

  • How can I move out the char Θ

    hello.
    How can I move out the char Θ (unicode U+0398) оn Jspx-page used af:outputlabel.
    When I write <af:outputLabel value="27. char(Θ)" />, application auto replace on char "?".
    thx, Dema.

    Hello
    Probably an encoding problem.
    try changing your charset into your JSP:
    ex: <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    I tried it and it works for me
    Jack

  • How can i find out the resolution and accuracy of PXI-6602 module?

    I have a 32 bit  8 channel PXI-6602 counter module.  PXI card is interfaced to PC with MXI-4 link. How can i find out the resolution and accuracy of this system.What is the maximum accuracy and resolution i will get from this system. Because optical signal to cmos conversion signal is given as a input to the counter.

    Hi chandhu,
    Were you referring to the accuracy of the count register or the timing clock? 
    PXI-6602 specifications can be found in the NI 660x Specifications.  The resolution of the count register is, as you’ve noted, 32 bits.  This corresponds to a maximum count value of 4,294,967,295.  As long as all of the edges are in accordance with TTL specifications, the accuracy of the count register is 100%.
    On the other hand, the PXI-6602 baseclock accuracy takes on the baseclock accuracy of the PXI CLK 10 signal.  Again, this is all found in the specifications.
    You may also want to check out the NI 660x User Manual – it contains a lot of details on the operation of these counter/timer devices.
    I hope this helps.  Please post back if you have further questions.
    Ed W.
    Applications Engineer
    National Instruments

  • How can I find out the age of my imac

    How can I find out the age of my computer to see if it will be able to download latest operating system

    Open System Profiler in Utilities folder. Look for the Model ID on the right. Then see the following:
    Upgrade Paths to Snow Leopard, Lion, and/or Mountain Lion
    You can upgrade to Mountain Lion from Lion or directly from Snow Leopard. Mountain Lion can be downloaded from the Mac App Store for $19.99. To access the App Store you must have Snow Leopard 10.6.6 or later installed.
    Upgrading to Snow Leopard
    You can purchase Snow Leopard through the Apple Store: Mac OS X 10.6 Snow Leopard — Apple Store (U.S.). The price is $19.99 plus tax. You will be sent physical media by mail after placing your order.
    After you install Snow Leopard you will have to download and install the Mac OS X 10.6.8 Update Combo v1.1 to update Snow Leopard to 10.6.8 and give you access to the App Store. Access to the App Store enables you to download Mountain Lion if your computer meets the requirements.
         Snow Leopard General Requirements
           1. Mac computer with an Intel processor
           2. 1GB of memory
           3. 5GB of available disk space
           4. DVD drive for installation
           5. Some features require a compatible Internet service provider;
               fees may apply.
           6. Some features require Apple’s iCloud services; fees and
               terms apply.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mountain Lion, it may still meet the requirements to install Lion.
    You can purchase Lion by contacting Customer Service: Contacting Apple for support and service — this includes international calling numbers. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.
    Upgrading to Mountain Lion
    To upgrade to Mountain Lion you must have Snow Leopard 10.6.8 or Lion installed. Purchase and download Mountain Lion from the App Store. Sign in using your Apple ID. Mountain Lion is $19.99 plus tax. The file is quite large, over 4 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
         OS X Mountain Lion — System Requirements
           Macs that can be upgraded to OS X Mountain Lion
             1. iMac (Mid 2007 or newer) — Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) —
                 Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) — Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) — Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) — Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) — Model Identifier 3,1 or later
             7. Xserve (Early 2009) — Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
    Are my applications compatible?
             See App Compatibility Table — RoaringApps.
         For a complete How-To introduction from Apple see Upgrade to OS X Mountain Lion.

Maybe you are looking for

  • How to display the last row in a table

    I have a table that is constantly updating, and I always want to see the last row. How can I get my table to auto scroll?

  • Query for last 5 Purchase Price for items

    Dear All I was trying to write a query in which i want to display Items with last 5 purchase price itemcode     UOM      Last Purchase Price        II Last Pur Price       III Last Pur Price        IV Last Pur Price         V Last Pur Price but not g

  • Jsf 1.2 problem

    When i use jsf1.2 and when starting Tomcat it can't start applications with jsf1.2, but 1.1 webapps are started. when using jsf 1.2 it shows like this INFO: Installing web application at context path /c2 from URL file:D:/jakarta-to mcat-5.0.28/webapp

  • Parsing CDATA

    Am I missing something simple? The research I've done all say that reading cdata from an xml in flash is easy, so they don't explain how. Here's my problem. Node looks like this: <DDATE> <#cdata-section>2007-06-19 14:38:58.0</#cdata-section> </DDATE>

  • Z68A-GD80 Lucidlogix Virtu upgrade from version 1.1.101 downgrades to Evaluation

    I am posting this because I have lost hours for searching for a solution and assume that other people may have this problem. I recently bought motherboard Z68A-GD80 mainly because of it's Virtu support. Upon installing Virtu from motherboard CD (vers