Convert date in BST to GMT format

Here date and cal.getTime() return date in BST format. But my requirement is date should be converted to GMT format and then compared with cal.getTime() which is in BST format.
          Object o = timeStamp.get(TIMESTAMP_OBJECT);
            java.util.Date date = (java.util.Date) o;
            Calendar cal = Calendar.getInstance();
            getBDO().setLastDespatch(isLastDespatch(cal.getTime(), date));
public static boolean isLastDespatch(Date counterDate, Date lastDespatchDate)
        if (counterDate.before(lastDespatchDate))
            // last despatch timestamp before
            return false;
        else
            // last despatch timestamp expired, therefore tell clerk
            return true;
    }I tried
Object g = date.toGMTString();
But I am not able to convert this object to again Date...

NewComer_forum wrote:
I tried with below code but throwing exceptions
String g = date.toGMTString();
SimpleDateFormat date1 = new SimpleDateFormat(g);
You of course read the Javadoc, and so know that the argument to the constructor SimpleDateFormat(String) is the pattern by which you want to parse, and not the string you want to parse itself, right? I mean, you didn't just try one random thing to prove that you gave it a minimal effort before coming back here for more handholding, correct?
Do me a favour and try my suggestion before continuing. I don't know for sure that it will work, but I think it's likely.

Similar Messages

  • Time convertion b/w BST to GMT

    Hi Guys,
    Is there any Oracle function to convert British time Zone(BST) to Green wich meen time Zone(GMT).
    if it is there would you please help me by Explaining that..
    I need to covert Trade execution time from BST to GMT wich should Need to be in GMT.
    Thankx In Advance...
    thankx,
    Lakshmi.

    Hi and welcome to the forum!
    Your question has been asked before, see f.i.:
    Re: Converting Date to timestamp with time zone
    (Do some more searches on this forum to find more examples)
    Read all about TIMESTAMP, CAST, FROM_TZ @ http://tahiti.oracle.com (the Oracle Documentation).
    If that doesn't get you going, then please post your DB-version and your efforts sofar.

  • How to convert date  into dd mon yyyy format

    hi all,
    i have a problem in date format i am using date like below .
    <%java.util.Date date = new java.util.Date();%>
    i am inserting date into a table and its storing like this
    insert into tablename (d_date) values (date)
    and its inserting date like below
    Sun Oct 19 09:05:45 GMT+03:00 2003
    i want to fetch date in dd mon yyyy format.
    with this format i want to make a select query.i struck with the format conversion.
    how to do this.
    any comments please.
    any help

    hi all,
    i understand now where i am wrong.
    the below code is not working why because in my server where i am executing code the regional setting month value is in arabic.
    i executed the same code in a different server where date and time jones are english its working fine.
    All the problem is in regional setting and not the jsp code.
    <%
    String whtEverDateFormatYouWAnt = "dd MMM yy";
    String str = new SimpleDateFormat(whtEverDateFormatYouWAnt).format(new SimpleDateFormat("EEE MMM dd HH:mm:ss vvv yyyy").parse("Sun Oct 19 09:05:45 GMT+03:00 2003"));
    out.print(str);
    %>
    Thanks a lot for the excellent solution.
    Thanks again.

  • FM to convert Date Entered to a standard format

    Hello All,
    Is there any FM to convert the date entered (in the format given in SU01) to a standard format
    (Eg: DD.MM.YYYY).  Is there any FM that does the reverse of it.
    Please help us out with your suggesstions.
    Thanks,
    Seetharaman V

    Hi seetharaman,
    please refer the following link for using the conversion exit for date in BSP application.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72d7ac11-0501-0010-63a2-cc6960569926
    hpe this ll help.
    thnks.

  • Converting dat/timestamp field into desired format

    Hi all
    How do I convert sysdate or current_timestamp to the following format?
    August 26, 2002 11:44:00 AM PDT
    I am struggling mainly with the timezone portion (PDT) etc.
    Would appreciate any help - Thanx!:)
    Regards
    Menon:)

    You won't be able to add the timezone to the date format itself. You'll rather have to tack on the literal string to the end of the date string.
    select to_char(sysdate,'fmMonth dd, yyyy hh:mi:ss AM')||' PDT' from dual;
    Armand

  • 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?

  • Convert Date in dd-MM-yy format

    I am taking parameter as date in front end and I am comparing it with database through view object through executeParams. But both the date formats are different, that's why I can't compare both formats. Please suggest me to compare both formats in dd-MM-yy format. I am taking parameter by inputDate component.

    Hi,
    Use this code inside your where clause
    apply_date=to_date('"+getdate()+"','rrrr-mm-dd')in the 'apply_date' write your table column name which you want to compare.
    getDate() is date type 'value binding' of InputDate component.
    RAFAT

  • Converting string to date in mm/dd/yyyy format

    Hi,
    I used simpledateformat to convert date to "MM/dd/yyyy" format.
    Now when i want to insert into db, i want the value as date object instead of string [returned by format method of SimpleDateFormat]
    what should i do?
    Date dt = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    System.out.println("Formatted date is coming as "+sdf.format(dt));
    Date dt1 = sdf.parse(sdf.format(dt);
    System.out.println("parsed date is coming as " +dt1);
    output :
    1 SOP returns 11/07/2007 [current date]
    2 SOP returns Wed Nov 07 00:00:00 GMT+05:30 2007

    If you are using PreparedStatements setDate method, you need a java.sql.Date object, not a Java.util.Date object. You can create an sql.Date object from a util.Date object as follows:
    java.sql.Date sqlDate = new java.sql.Date(dt.getTime());And, if you are not using PreparedStatement and its setDate method, then change now.
    Doing
    Date dt1 = sdf.parse(sdf.format(dt));is meaningless. You format the date to string, then parse the string back to a date? Why? Why not just use the original Date object? And you won't get a sql.Date object that way, either, as the DateFormat classes return a util.Date object.
    Edit: And for more info:
    A Date does not have a format. It is simply a number. The "format" only comes into play when printing the String representation of the Date, and that is not handled by the Date object itself (except when calling toString either explicitly or implicitly).

  • How to convert date format to MM/DD/YYYY

    Hi,
       How to convert date format to MM/DD/YYYY.
    Thanks,
    Senthil

    hi,
    tri with this function module
    data :l_date(10) type c
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
    EXPORTING
       DATE_INTERNAL                  = SY-DATUM
    IMPORTING
       DATE_EXTERNAL                  = l_date.
    this function module converts date from 20050601 to external format  which is specified in user profile
    cheers,
    sasi

  • Convert date from YYYYMMDD to DDMMYYYY

    Please help if anyone knows any function module to convert date from YYYYMMDD to DDMMYYYY format..
    Thanks in Advance,
    manjari

    Hello.
    Simply do like this:
    DATA: datum TYPE char10.
    WRITE sy-datum TO datum <format option>.
    <format options>:
    DD/MM/YY and MM/DD/YY:
    Both additions have the same effect. The date output has a two-digit year value and a separator. The separator and the order are taken from the definition for date output in the user master record.
    DD/MM/YYYY und MM/DD/YYYY:
    Both additions have the same effect. The date output has a four-digit year value and separator. The separator and the order are taken from the definition for date output in the user master record.
    DDMMYY und MMDDYY:
    Both additions have the same effect. The date output has a two-digit year value and no separator. The order is taken from the definition for date output in the user master record.
    YYMMDD:
    This addition provides a date output with a two-digit year value without a separator in the format YYMMDD.
    Regards.
    Valter Oliveira.

  • 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

  • HELP - How to Convert Date in GMT to Local time in Applet

    Hi All
    Is there a way to convert a date from GMT format into a local time say IST in my Java applet, this GMT date is coming from a postgresql database.
    Thanks in advance
    Swaraj

    Try this with your customization:
    java.text.SimpleDateFormat format0 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    java.text.SimpleDateFormat format1 = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    java.util.Calendar cal0 = Calendar.getInstance(new SimpleTimeZone(0, "GMT"));
    java.util.Calendar cal1 = Calendar.getInstance(new SimpleTimeZone((int)(5.5*60*60*1000), "IST"));
    format0.setCalendar(cal0);
    format1.setCalendar(cal1);
    java.util.Date date = format0.parse("2003-01-25 00:15:30");
    java.lang.String formatted = format1.format(date);
    System.out.println(formatted);

  • How to convert date format into sap standard format?

    Hi All,
    In SAPUI5 screen i have one simple form in form i have date field which is format  (MM/DD/YYYY). but i am getting POST error while inserting the data in to sap table.
    I want convert date format in sap format (YYYY/MM/DD).
    One more issue, when i am fetching the data from sap table,but  the date display with time and time zone.
    eg. Sat Aug 02 2014 05:30:00 GMT+0530 (India Standard Time)
    I want to display only date.
    Thanks,
    Prashant.

    Now i am using <DatePicker id="Emp_fsdate" displayFormat="yyyy-MM-dd"/>
    I checked in console, but date is display like mm/dd/yy
    In my controller.js file i have written code
    OData.request
               requestUri: "http:sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata", 
               method: "GET",
               headers:
               "X-Requested-With": "XMLHttpRequest",
               "Content-Type": "application/atom+xml",
               "DataServiceVersion": "2.0",       
               "X-CSRF-Token":"Fetch"
           function (data, response){
            var header_xcsrf_token = response.headers['x-csrf-token'];
                       OData.request
                            requestUri:
                             "http://sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata", 
                            method: "POST",
                            headers:
                          "X-Requested-With": "XMLHttpRequest",                     
                            "Content-Type": "application/atom+xml",
                            "DataServiceVersion": "2.0",
                            "Accept": "application/atom+xml,application/atomsvc+xml,application/xml",
                            "X-CSRF-Token": header_xcsrf_token
                            data:
                                   Empid:Emp_id,
                                   Empname:Emp_name,
                                   Start_Date:Emp_sdate,
    //                              End_Date:Emp_edate,
                                   Status:Emp_status,
                                   City:Emp_city,
                                   Location:Emp_location,
    and in my CREATE_ENTITY method
    method ES_SODATA_CREATE_ENTITY.
         DATA: ls_request_input_data TYPE zcl_zservice_final_mpc=>ts_et_sodata,
             ls_userinfo TYPE zsodata.
       DATA ls_temp TYPE sy-datum.
    * Read Request Data
       io_data_provider->read_entry_data( IMPORTING es_data = ls_request_input_data ).
    * Fill workarea to be inserted
       ls_userinfo-Empid   = ls_request_input_data-Empid.
       ls_userinfo-Empname   = ls_request_input_data-Empname.
       ls_userinfo-Start_Date   = ls_request_input_data-Start_Date.
       ls_userinfo-End_Date   = ls_request_input_data-End_Date.
       ls_userinfo-Status   = ls_request_input_data-Status.
       ls_userinfo-City   = ls_request_input_data-City.
       ls_userinfo-Location   = ls_request_input_data-Location.
    * Insert Data in table ZUSERINFO
       INSERT zsodata FROM ls_userinfo.
       IF sy-subrc = 0.
         er_entity = ls_request_input_data. "Fill Exporting parameter ER_ENTITY
       ENDIF.
       endmethod.
    But still i am getting an error
    POST http://sap/opu/odata/sap/ZSERVICE_FINAL_SRV/es_sodata 500 (Internal Server Error)
    I am able to insert all field except date field. How to insert date field in sap table.

  • 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

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

Maybe you are looking for

  • Massive Deletion of Open Sales Orders/Deliveries

    Hi, I was wondering if anyone knows a massive transaction to delete open sales orders and deliveries. I try using de MASS transaccion but here I can only reject the items (in sales orders) but the thing is that the customer wants the open orders and

  • "undefined symbol" error while using a custom instrument driver

    Hello all, I'm facing a problem related to instrument driver creation. I want to pack a part of my code to a .FP to be able to reuse it in other applications of mine. This part of code includes calls to Windows API and a third party dll. I have inclu

  • Javascript in Acrobat X

    There is no such thing as a stupid question, right? So here goes--Does Javascript automatically come with Acrobat or is it something I have to download or buy to use? And if so, what exactly (name, version) do I need to download or buy for use in Acr

  • Fuel condition

    hi all. i have a n issue in 3.1 system:  we have third party order.as per the customised process the fuel surchage condition is calculated on the bases of gross weight .as per our 3rd party order we not have shippment ,vendor directly delivery good t

  • How to download Intel instead of PowerPC

    I just downloaded Premiere CS6, and it won't open because it is a PowerPC application which is not supported on Mavericks. How do I download the Intel version instead? I don't see any option to choose a version.