Times to GMT

Suppose I have times, in the past (many before 1970), in many different time zones. No matter what the time, zone, or dst situation, I need to convert these to the correct UTC. Not for the purpose of printing, but for internal, programmatic calculations.
So, for example, let's say we have June 5, 1966, at 10:24:51 EDT. I need to get this into UTC so that I can perform calculations that require time in UTC.
I've seen a lot of code in the archives around similar questions, but most of them assume that you're trying to format this correctly to print, or that the formulae for daylight savings time is the same as it is currently. One of the things I want to be able to set manually is whether DST was in effect or not. For example, in Germany during the 1940s, they had "war time" which was actually a two hour dst. it seems that the TimeZone class automatically determines dst, which could be a problem for these old dates.
Ten Duke dollars to anyone who can show me the full code for handling this problem.

Hi,
In my work as Chief Scientist working with researchers in diverse fields, I have had to address this problem myself. There are a couple of approaches to consider, one of the ones I'll share is more elegant but has its own drawbacks...
In any method you choose, the key here is to understand that any 'date-time' field is incomplete information if it does not also include the GMT offset (or UDT, as is slightly more correct these days). You may know the GMT offset value because you know the source of the data, or because it was specified to you. ...I have found that there are a number of places around the world that have non-whole-hour offsets, so you can't just add or subtract hours and have your code be correct the world over. I therefore use a minutes offset value.
Note also that the direction of the offset "doesnt' matter" so long as YOU know when to add and when to subtract your offset value. And it helps if you choose the + or - sign methodology in connection with user expectations (which, I have learned, are not universal).
The more graceful method, which I don't use, by the way, is to create a "cronon type" object that includes the GMT (UDT) offset, and for which there are various methods to get local time and put local time and set and fetch the offset value. This gives you most of what you want - maybe you'll add comparative methods in your class, or maybe you'll leave that to the application code that uses your new cronon type - that's up to you.
Another way, which is what I use, is to assign an offset value to sources of data and then contextually switch to and from local time or "Universal Time" depending, again, on the context of the call. This is a fine solution when you are mixing and matching datasets that came from different sources but which have a well defined context of useage. WARNING: YOU MUST HAVE A WELL DEFINED SEMANTIC FOR CONTEXTUAL USE FOR THIS STRATEGY TO WORK RELIABLY! That is, go with the cronon class route if you don't have or can't rely upon useage paterns.
Hope this helps,
Richard

Similar Messages

  • Need to convert time to GMT or UNIVERSAL CO-ORDINATED TIME

    Hi,
        I need to convert a date and time to UNIVERSAL CO-ORDINATED TIME or GMT. Is there any function module to do the same. Please do let me know.
    TIA
    Gurpreet

    Hi,
    Here is the example program to conver the time to UTC
    DATA: time_stamp TYPE timestamp,
           dat TYPE d,
           tim TYPE t,
           tz   TYPE ttzz-tzone,
           dst (1) TYPE c.
    tz = 'UTC '.     " You need to maintain the ZONE
    time_stamp = 20030309033000.
    CONVERT TIME STAMP time_stamp TIME ZONE tz
            INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst.
    WRITE: /(10) dat, (8) tim, dst.
    time_stamp = 20030309043000.
    CONVERT TIME STAMP time_stamp TIME ZONE tz
            INTO DATE dat TIME tim DAYLIGHT SAVING TIME dst.
    WRITE: /(10) dat, (8) tim, dst.
    Regards
    Sudheer

  • How do get current date/time in GMT?

    Is there any way to get the current date and time in GMT (while my current locale is not GMT)?
    In Java I can do this:
    long currenttime = System.currentTimeMillis();
    java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");
    df.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
    java.util.Date date = new java.util.Date();
    date.setTime(currenttime);But, there seems to be no way to do the equivalent in BPEL in SOA Suite.
    I did some research and I think I could appy the XPath 2.0 function adjust-dateTime-to-timezone() to the current time, but that function is not available.
    Using SOA SUite 11.1.13.0.
    THanks.

    have you tried changing the stylesheet version in the xsl to 2.0 and then try the function again ?
    by changing this version it was possible to use newer functions, which weren't available in the designer

  • Function Module To Change TIME from GMT to CST

    Hello All,
    Can anyone tell me if there is any Function Module to convert the TIME from GMT to CST?
    Regards

    Hi Sunil,
    use the following code.
    DATA :
      timestamp like TZONREF-TSTAMPS,
      time      like sy-uzeit,
      date      like sy-datum.
    The following function module is used to convert the
    time and date into GMT timestamp
    CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
      EXPORTING
        i_datlo           = sy-datum
        i_timlo           = sy-uzeit
        I_TZONE           = 'INDIA'
    IMPORTING
       E_TIMESTAMP       = timestamp.
    The following function module is used to convert the
    above obtained timestamp to PST timezone date and time.
    CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
      EXPORTING
        i_timestamp       = timestamp
        I_TZONE           = 'CST'
    IMPORTING
        E_DATLO           = date
        E_TIMLO           = time.
    write :/ 'Date and Time at PST zone is ',date, time.
    Reward if helpful.
    Thanks,
    Naveen.

  • Convert Local Date and Time into GMT

    In Oracle how to convert date & time in GMT. Suppose the input will be local date & time e.g. ‘IN’, ‘15/11/2010 15:20:30’ ( country Code, DD/MM/YYYY Hr:Min:Sec in 24hr format) output should be in GMT format.

    I don't think this should be in the OLAP subforum. At least try to look for the correct section before posting next time.
    Apart from that, you can try a combination of the From_Tz and Tz_Offset functions.
    http://www.techonthenet.com/oracle/functions/from_tz.php
    http://www.techonthenet.com/oracle/functions/tz_offset.php
    I hope it helps.
    Joan

  • Convert local time to GMT

    Hi everybody,
    i receive a lot of operation date from many worldwide ports like these:
    SINGAPORE 23/FEB/2011 13:50 (local time)
    GHENT(NL) 23/FEB/2011 12:00 (local time)
    i'm required to convert these information to GMT date.
    I've found NEW_TIME function but it seems inadequate:
    1) the function does not consider daylight saving periods; i mean when tmz1 switches from daylight savings on to daylight savings off and tmz2 does not, the function does not change the time difference (at least it's the result of my test unless all valid timezones switch at the same time)
    2) valid parameters are 18 therefore they don't cover all the possible combinations
    Could you please help to cope the matter ?
    Many thanks in advance
    Stefano

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by David Hsiung ([email protected]):
    How can i convert local time to GMT time in
    the Form?<HR></BLOCKQUOTE>
    David,
    there is a date function caled NEW_TIME that should work. For ex:
    select to_char(new_time (sysdate, 'EST','GMT'), 'HH:MI:SS')
    from dual;
    05:31:00

  • Outlook Client recurring appointments time zone / GMT offset problem

    I will try to describe this with text, although it's a very visual problem.  I added a post to my blog with
    it so I could include pictures.  If you think you need pictures to understand the text below, please review that entry.  Please note, the one appointment instance cited below, is an example, there are many others with this same problem,
    and it only happens with recurring appointments.
    Relevant System Information:
    Windows 7 Utlimate
    Office 2010 Professional Plus (14.0.6023.1000 64-bit)
    Exchange services hosted by Microsoft.
    Android HTC Inspire 4G also configured as exchange active sync client.
    Issue Description:
    I have a specifications meeting that is scheduled for Tuesday mornings (every 2 weeks) at 8:30 am.  In the body of the appointment, it even has this text spelled out.  "When: Occurs every 2 weeks on Tuesday effective 11/23/2010 from 8:30
    AM to 11:30 AM (UTC-05:00) Eastern Time (US & Canada)." as an indicator of the actual appointment time.  The problem is that one day, several weeks after this appointment had been sent to me, Outlook 2010 decided that it was really at 1:30 PM. 
    Since that time it's been showing incorrectly on my calendar at 1:30 PM.   So, I recognized almost immediately that this was a 5 hour difference, which happens to also be my timezone offset (except that I'm currently in daylight savings time -- so
    it's really a -4 offset right now).
    I ran the 2010 service pack 1 installer, based on the suggestion of my IT group, and found I already had the service pack installed.  I've tried the timezone tool as well and that didn't work.  Please keep reading.
    Next I went to my exchange host with outlook web access.   The appointment is closer to correct there, showing at 9:30am.  It think here it almost seems as though it's applying the DST, but not correctly, maybe doubling it?. 
    Meanwhile, back in outlook, if I go to the scheduling assistant and look at my time while making an appointment with other invitees it - much to my surprise - matches the time in OWA, not the time in outlook client.
    Finally, if I go to my Android and look at the appointment, it is correct.  8:30 AM.  
    So to summarize:
    Real Appoinment:   8:30 AM
    Outlook Client Time: 1:30 PM
    OWA / Exchange Time: 9:30 AM
    Android Calendar Time: 8:30 AM
    This applies to many others, this is just a convenient example.
    This applies only to recurring appointments.
    Any help would be very appreciated.
    Thanks,
    Jon

    Status Update, and recommended next steps:
    I opened a ticket with HTC support the day before yesterday (Ticket # 03543601). The initial response was an email reply with the typical level one suggestion to remove and re-add the Exchange ActiveSync account on my phone, and if that didn't resolve the
    issue to do a hard reset and then add the account again. Since I have multiple users experiencing this same issue, where the common denominator seems to be centralized around the move from Outlook 2007 to 2010 and the HTC Gingerbread OS, I convinced them that
    this would not be an acceptable remedy, and my case was immediately escalated without hesitation. I will say that though I don't have a resolution, I'll applaud HTC for not giving me the runaround and giving me a live person who could talk intelligently about
    the issue.
    Today, I received a phone call back on this ticket  from someone in the escalations department at HTC named Travis. After explaining the issue in detail to him and referencing
    this specific thread, he acknowledged that it did in fact sound like a coding issue coming from the device where the value in the “dispidApptTZDefStartDisplay” property was being set improperly by the device/stock email/calendar application in their implementation
    of ActiveSync. He then stated that he would relay this to the developers to look into the issue. He further elaborated that the case would either be in a status of, "this is being looked into", or "We believe this to be resolved in [x] update". He said that
    they will probably continue releasing updates for the Incredible (I did not specifically ask about the Incredible 2), and while the Incredible 2 is definitely slated to get Ice Cream Sandwich, the Incredible one is still in a classification of, "being evaluated".
    Personally, I doubt that the Inc 1 will get ICS, but it is possible. From what I have read, the general stance is that phones will be updated for 18 months after release, and the Inc 1 is 24 months old this month (bummer - I REALLY like this phone).
    According to Verizon and HTC, these are the phones that will get ICS (or Android 4.0):
    Ice Cream Sandwich Coming to Many Verizon Wireless Smartphones
    Android 4.0, Ice Cream Sandwich Updates
    While it is possible that an update will be released for the Incredible 1 to fix this issue, it will likely be months before one is available, so we'll probably have to move to Touchdown for Exchange by NitroDesk in order to resolve this issue....or move to
    a newer phone with ICS 4.0.
    Speaking of which, there is a whole laundry list of issues with Exchange ActiveSync and third-party devices. A number of them are listed in this Microsoft KB article:
    Current issues with Microsoft Exchange ActiveSync and third-party devices
    Per the article:
    Microsoft's recommendation for Android - Upgrade to Android OS 4.0
    Microsoft's recommendation for iPhone/iOS devices - Upgrade to iOS version 5
    So, for anyone on Android experiencing this issue (or others listed in the Microsoft KB above), if your phone is likely to get ICS soon, then you may want to hold on and just be vigilant about checking your calendar on OWA. If your phone isn't slated to get
    ICS or if you can't wait, my recommendation is to get Touchdown for $20. You may still have to delete and re-create appointments that are wrong, but hopefully the issue won't happen any more once you move to Touchdown. And if they do, at least you've got a
    shot at a more rapid fix with a company like NitroDesk. (no offense HTC).
    Good luck. I probably won't post again unless I get notice of a fix for this specific issue or some other significantly useful information.
    Jonathan, MCSE
    For reference, here are other forums where this same issue has been discussed:
    Weird Outlook issue
    Calendar appointments move by 5 hours (or whatever the TZOffset
    is) - ActiveSync issue?
    Outlook Client recurring appointments time
    zone / GMT offset problem (This is the thread that you are presently reading)
    Outlook 2010. Recurring meeting time off by 5 hours, what is the problem?
    Recurring Calendar Appointment shifted 6 hours later in Outlook 2010
    (maybe ActiveSync)

  • Message time still GMT in Mail list for CenturyTel users

    (The two previous strands of this question from 2007 have been archived. I'm still running Tiger.) In the MacMail list of incoming messages, every message from CenturyTel, even from my husband across the room, is listed with the time as GMT , not the PDT everything else shows. So, of course, it fouls up the order of receipt of messages. While I'd like to blame CenturyTel, and have asked a tech. about it and got nowhere, the time is translated correctly if I receive messages using Thunderbird. So I think it is an error in MacMail. Long headers look fine. Any ideas? I may just move on to Leopard in hopes it is not plagued by this irritating snag. Thanks for your comments.

    After updating my iMac to OS 10.5.6 the problem disappeared. 'Just a bug I've left behind in 10.4.11. So I'll call it solved.

  • Time in GMT Format

    Hi
    I want to display current time in GMT format.
    Can anyone tell me the query to display current time in GMT format.
    -haifriends

    Then, like i said, you'd want to use SYS_EXTRACT_UTC
    SCOTT @ nx102 JCAVE9420> select systimestamp from dual;
    SYSTIMESTAMP
    08-OCT-06 01.42.54.673000 AM -04:00
    Elapsed: 00:00:00.09
    SCOTT @ nx102 JCAVE9420> select sys_extract_utc( systimestamp ) from dual;
    SYS_EXTRACT_UTC(SYSTIMESTAMP)
    08-OCT-06 05.43.06.626000 AM
    Elapsed: 00:00:00.01Justin

  • NEW_TIME : Central European Time to GMT

    I execute this request
    SELECT NEW_TIME(sysdate, 'CET', 'GMT') "Central European Time to GMT" FROM DUAL
    =>
    and i have this error:
    Oracle error: ORA-01857: ce n'est pas une plage horaire valide (sev 1, MsgNo 1857).
    So, help please

    Hi
    Check out the Oracle note 102529.1 on new_time
    https://metalink.oracle.com/metalink/plsql/f?p=130:14:9028019237347794912::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,102529.1,1,1,1,helvetica
    which basically says that new_time supports only a limited set of time zones (USA only + GMT.) CET is not one of them and
    <quote>
    you will need to manipulate the current time via a sysdate function
    SQL> select NEW_TIME(sysdate+1/24,'HDT','GMT') from dual@dblnk2
    Results in 1:00 PM which corresponds to the time in Paris.
    </quote>
    HDT = Hawaiian Daylight saving time (which I hope corresponds to Paris go forward and go backs!)
    Hope this helps
    Ian

  • Xp20:current-dateTime give time of GMT, not of our timezone

    Hi,
    process call xp20:current-dateTime(), this function give time of GMT, not of our timezone(China, GMT+8).
    for example, I call it at 10:20AM, but it return 2:20AM.
    I have edit opmn.xml, at oc4j_soa instance, add "-Duser.timezone=GMT+8" in java-options, restart soa suite.
    but not take effect.
    the server is SOA Suite 10.1.3.3 on Windows 2003.
    any suggestion is welcome.Thanks

    Thats great but what is the timezone of your server where soa suite is installed. Also what is the timezone of the dehydration store server?
    cheers
    James

  • Internationalization  issue : convert date/time to GMT/UTC

    We have our webservices running in websphere /oracle.There is this requirement to internationalize the application ...like
    a) language .....
    d)Internatiolization of time :
    For this requirment I am planning to do the following.Service request with date will be converted to GMT before it is stored in database and the response back will be converted from GMT back to the time zone of the requester and have the application server/database server configured to UTC time.Is this a good strategy or is there a better one.
    Thanks
    m

    Manjit wrote:
    Sabre,to confirm again...you are suggesting that there is even no need to change the oracle Date field from Date type to Timestamp.The only thing I really have to do is for display purpose convert/format the response date to the zone the request is coming from.Please let me know if I missed anything.The above statement is indefinite.
    Are you starting with a java.util.Date or perhaps a java.sql.Timestamp?
    Then you do NOT convert them. You display them. You use SimpleDateFormat for that. You do not concern yourself at all with timezones exception in terms of creating a SimpleDateFormat. And that is ONLY an issue if you are creating the string (display value) on a server. If you are doing that you will need the client to provide you with a timezone. There is no magic way to get that from the client. If a client app is doing the display the the client is running in a client VM and that VM will already have a display format that might be suitable.
    Conversely if you are receiving a timestamp value as a text value (say read it from a file) then you must convert that into a java.util.Date. You do that via SimpleDateFormat. The specifics of how you do that depends on the form of the text value.

  • Convert date/time to GMT format

    Hi,
    I want to convert my current system date to GMT format. the class java.util.Time/Calender have methods which help u to convert from GMT to local time.
    is there a method to convert from current System Date to GMT.
    tx in advance

    i found the answer to my earlier question from the postings. Now i need help with the format og the Date in GMT.
    i used the following code to get the GMT based on the system time
    Calendar here = Calendar.getInstance();
    int gmtoffset = here.get(Calendar.DST_OFFSET)
    + here.get(Calendar.ZONE_OFFSET);
    //to convert to GMT time
    Date GMTDate = new Date(System.currentTimeMillis() - gmtoffset);
    the result of exceuting the following code is
    GMT Date is Mon Aug 20 18:39:19 EDT 2001
    but i need the GMT time in this format
    20010820-18:39:40
    tx
    Namrata

  • Problem in converting the String to Date with time zone GMT

    Hi,
    When I tried to convert the string 12/05/2009 to Date, the time zone is set to BST.On the other hand, for the date 12/12/2009, the time zone is set to GMT. What should I do to get the time zone as GMT all the time.?
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    String dateString = "12/05/2009";
    System.out.println(myDate.toString());

    I think you are all missing the point. java.util.Date objects always alway always store the date as the number of milliseconds since 1/1/1970 UTC so the only TimeZone they have its the implicit UTC. When you use the Date.toString() method the toString() method gets the default time zone from your environment and formats the data accordingly. This means that the same Date object will, by default, produce a different result for France and Australia and the US.
    So, if you have the date "12/5/2009" as a String then to convert it to a java.util.Date you must specify what TimeZone is implied. If it is your system time zone then you can just create a SimpleDateFormat object with the correct format and then use the parse() method to create the java.util.Date object and this will automatically be converted to UTC. If the date String represents some other time zone then you must explicitly set the time zone of the SimpleDateFormat object before parsing the string.
    The same approach applies when converting a java.util.Date object to a String. If you want anything other than your system time zone then you must explicitly tell the SimpleDateFormat what time zone you want the result formatted for.

  • Email Templates and Date and Time in GMT Format

    How do I send the date and time captured on the service form to the customer and not how it renders in GMT when sent in the email template
    Solution: Copy the service form field into a hidden field.  Reference the hidden field in the email template and it appears in the email template as entered on the form.

    But what about a system generated date/time like trying to notify a task assignee of the due date/time of their task?

  • Conversion of Unix time to GMT

    Does anyone know of a way in which I can turn a date in unix time (no. of seconds since 1st Jan 1970) into a standard GMT format?
    Any help would be greatly appreciated.
    Thanks!

    To use GMT time, use TimeZone:
    * UnixTime.java
    * Created on February 16, 2006, 11:20 AM
    * @author Charles Li
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import java.util.TimeZone;
    public class UnixTime {
        public static void main(String[] args) {
            GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("GMT+0"));
            long unixTime = 1234567890L; // unix time is second
            long ONE_SECOND = 1000L; // 1 second = 1000 millisecond
            gc.setTimeInMillis(unixTime*ONE_SECOND);
            // 2009/2/13
            System.out.println("Year: " + gc.get(Calendar.YEAR));
            System.out.println("Month: " + (gc.get(Calendar.MONTH)+1));
            System.out.println("Day: " + gc.get(Calendar.DAY_OF_MONTH));
    }

Maybe you are looking for

  • Idvd4 is in applications folder, but not recognized

    after numerous problems with iDVD freezing and shutting down, I tried installing the latest software update (4.0.1 updater) and much to my surprise it says idvd 4 was not found in /applications. can anyone solve my conundrum? (i've run cache out x, m

  • Query on batch scripting - Archival

    Hello, I am totally new to batch script.  Below is the requirement that needs to be developed using batch script.  Please suggest on how to proceed and a good link to learn about batch scripting too. Zip once in 2 weeks and deleted after a year. Than

  • I cant find back up in my library, y is this happenin?

    i cant find back up on my library? y is this happenin? some1 please help?

  • APEx reports - Groups

    Hi, I have the following requirement to do either in classing or IR report. Please help. Here is my queries output 5     John Smith     HRA     HR Concepts     01/01/12     12/28/12     5421100001     Y     Y 5     John Smith     HRA     HR Concepts 

  • Batch number in A/R Invoice pld

    Dear Experts   Please give the idea how to print the batch number in A/R Invoice if the invoice was copied from delivery. Thanks & Regards S.Ganesh