Converting a Date in UTC to the current timezone

I have a library which returns a Date in UTC.
I need to convert this Date to the current timezone, and then format it using SimpleDateFormat.
I've been trying for a while now, and I can't figure it out? Can anyone help?
Thanks,
Adam

SimpleDateFormat takes a timezone.
Date d = getDateInUTC();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
TimeZone tz = TimeZone.getTimeZone("PST")
sdf.setTimeZone(tz);
String sDate = sdf.format(d);

Similar Messages

  • I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

    I have Elements 11. Sometimes, if I edit a photo in Elements Editor, the date gets changed to the current date. Why does that happen? It doesn't happen all the time, so I can't isolate the cause. Any ideas?

  • I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks

    I have microsoft word for for my Mac book pro. When I open saved letters /documents on word the date automactically changes to the current date. How do I stop this happening? Many Thanks

    I suggest you post your qeustion on the Microsoft Mac forums as it's their software you're having issues with and that's where the MS experts hang out
    http://answers.microsoft.com/en-us/mac

  • Company code dates period to accept the current postings

    Hello experts,
    What should be the company code dates period to accept the current postings?
    I am trying to post stock in the company code for the current period.I have changed the period date for company code to 01/2008.But Its not accepting the current postings.
    Please advise.

    Hi
    Check the current postings period MMRV and make sure you have the current posting period in it.Please check your fiscal year start and end dates.For example April to March07 then the current period should be
    11-2007.
    This could answer your question.

  • Where do Date and Calendar get the current date?

    The server's time is correct, but my Java application is one hour fast... Why could that be?

    Maybe because Java has a different notion of "local time zone" than whatever you use to check the time.
    Try checking the local timezone that Java thinks is in effect and compare this with whatever the OS provides.
    A common case seems to be that Java has more up-to-date timezone data than the OS and Java is actually true.
    And: you could easily make a mistake by converting Date/Calendar/... around an mess up the timezone information (don't ask me how exactly, but I've seen it before).

  • How to convert exponential data into number for the downloaded excelsheet

    Hi
    I have downloaded one field data i.e. having char of 50,  into excel sheet and it is displaying as  exponential in the excel sheet. 
    The data numbers should display as text only i.e 1236547896321 and not exponential
    Is anyone can tell how we can do this
    Thanks
    Pallavi

    Hello Pallvai,
    The problem of exponential is with the excel. Excel converts the large numbet into exponential.
    To avoid this you can make the number into text then excel won't convert it into exponential.
    For that you can do a simple trick. Just prefix a single quote ( ' ) in the field.
    eg:
    field = 1236547896321.
    then,
    constants c_quote type c value '''.   "<-- single quote
    concatenate c_quote field into field.
    " This will make the EXCEL to consider this field as text not number and hence it will not be considered
    " as exponential.
    Hope this solves your problem.
    Regards,
    Sachinkumar Mehta

  • Alarm "On Date" doesn't use the current entry start time

    When setting an alarm and choosing "On Date" it sets the date and time according to the initial time of the entry even if you have changed it first.
    So for instance I create a new calendar entry, it will default the time to the next hour from now 9:00 am. I change the time to 1:00 pm. I then go down and choose Alarm -> message with sound -> on Date. It choosing 8:45 am ????
    FYE this has always behaved this way as long as I can remember

    I have just discovered this same behavior plus an additional alarm option now appears for that event. Seem like a bug.

  • How do I add a current date to a form field so that it will give me the current date each time it is opened?

    I have adobe 9 pro. I am currently adding fields to a document and would like my date field to display the current date when the document is opened so that the user does not have to enter the date each time. How do I do that?

    Have you searched for this issue. It has been answered many times.
    Example Acrobat JavaScripts
    Scroll down to the . Insert Today's Date into Form Field section.

  • Copying files to my MBA Early 2011, 10.6.7 changes their 'date modified' to the current date. It happens only to some of the files copied. Any idea what my be causing it. Never had this problem before, on othe macs I have owned.

    Copying files to my new MBA (early 2011) running 10.6.7 results in their 'modification date' to change to the current date. Any idea what may be causing it. It happens only to some of the files (there is no pattern to it.). I have not seen it previously in many other macs I have owned.

    Hi all
    I am bumping this thread again because I can't believe that I am the only one experiencing this issue. At times it is costing me hours repeatedly copying files until eventually the date doesn't show as modified.
    I thought I had cracked it earlier by changing the Sharing & Permissions settings, and applying to enclosed items the ability for Everyone, Me and Staff fo have Read & Write permissions - but that doesn't seemed to have changed much.
    Copying in smaller batches helps sometimes, but then other times it makes no odds, and the Date Modified date shows as the original date for a few seconds, only to change to today's date. Driving me nuts because there is no pattern to it.
    Files which I have copied and show their original modified date, when moved to a subfolder, then have their date changed to today!!! Copying other files into the folder results in files that were previously OK having their Date Modified changed!
    Am I on the only one?

  • Wrote the current Date and Time in the backend

    HI everyone,
    I created a table view, where I display several records. Right now I will add an record to this table, which should be written back in the backend and automaticaly add the current date and time.
    But I don´t know to make this. I tried several time with the funktion  "now()", but it doesn´t work. So any help for me, to explain how I can display the actual time and then write it back to the backend?
    Thanks

    we use a crm system. but the BAPI I mentioned was
    just to play with. My basis will develop a new API
    for the project, that have the requested Inputfields.
    But what I tottaly forget was, that there has to be a
    field for the time, so thanks for the advice.
    No Problem.
    I´m still of the opinion , that it should be possible
    to add the curret time in a field with the
    funcionality of the VC, even there is a way to show a
    clock with the current time. My problem is that I
    can´t figuer out how to do this.
    Therefore you can use the TNow() function (Time functions) and the Now() Function (Date functions). You can cast them to a string and concatenate the string, then you have the date of today with the current time. This string you can format and transfer it as input for your BAPI_ADD_BP for example.
    Hope that helps.
    Best Regards,
    Marcel

  • How to compare the current date to an inputed date?

    I am having a validation to check if the date is not After the current System Date?
         public String getDate_trans()
             try {
             Date x=new Date();<<Get the current Date
             Date date=new Date();
             DateFormat formatter ;
             formatter = new SimpleDateFormat("yyyy-MM-dd");
             date = (Date)formatter.parse(date_trans); <<<Inputed Date
                   System.out.println(date);
                   System.out.println(x);
                   if(date<x)
                        System.out.print("Date is Valid");
                                                   else
                                                     System.out.print("Date is invalid");
             catch (ParseException e)
        {System.out.println("Exception :"+e);    }
         return date_trans;
         }

    tr3k wrote:
    I dunno what to method to use in there...I'm so sorry...The closest method that I could use I think is the compareTo...but I dunno how I can use that to compare using greater than or less than.....Read the docs for that method. READ THE DESCRIPTION. What do you not understand about that?
    And there are two other methods that are even simpler. You haven't looked closely enough.

  • U0093Production Order Finish Dateu0094 is updated w/the current date.

    After removing the delivery block on a sales order schedule line, the
    “Production Order Finish Date” is updated w/the current date. It is  happening in Release 4.7.
    Why it's happening.

    Thanks for the reply, Dharma!
    I check my config and the system has the following settings:
    OPU3 - Start date in the past is set to 30 days w/backwards scheduling.  The production order in question has a start date less than 1 week old.
    OPPQ - Indicate start date in the past is allowed.
    It's also worth noting that a new schedule line is created after the finish date is updated.  The new schedule line delivery date is equal to the current date.
    Any other ideas?
    Edited by: Cal on Jan 25, 2008 5:32 PM

  • After updating my time and date is stuck on the time it was updated and the current time is overlapping that. How do I fix this??

    My time and date is stuck but the current time is overlapping the old date. I tried turning it off:(

    For how long? The update process takes time.

  • Maintain the current row position of a table after refresh.

    Hi,
    I use a poll to refresh tables continuously. when a table is refreshed, the current referring row is reset.
    To maintain the current row position after a refresh I use the following poll method.
    public void refreshTableT1(PollEvent pollEvent) {
    FacesContext fctx = FacesContext.getCurrentInstance();
    ValueBinding dcb = fctx.getApplication().createValueBinding("#{bindings}");
    DCBindingContainer bindings1 = (DCBindingContainer) dcb.getValue(fctx);
    DCIteratorBinding dciter = bindings1.findIteratorBinding("<VOIterator>");
    if(dciter!=null){
    if(dciter.getCurrentRow()!=null){   
    Key current_row_key = dciter.getCurrentRow().getKey();
    dciter.executeQuery();
    if(current_row_key!=null){
    try{
    dciter.setCurrentRowWithKey(current_row_key.toStringFormat(true));
    }catch(Exception ex) {
    System.out.println("Exception in current_row_key");
    }This works for normal tables well. But when I use it to master-detail tables (pair of tables) it does not.
    At the master-detail tables, before the first data fetch, it works well. if we go below the first data fetch, it sets the current row into another position.
    how can I overcome this...??
    Thanks,
    Dinuka.

    Hi Mr.Frank,
    I have an association in two VOs.
    for example: There are 2 tables called Emp and Dept. Every Department has Employees. so there is an association (both tables have a common column). Master table is the Dept table. when you click on one record of the Dept table Detail table will show the details of the employees belongs to that selected department. That's what I referred as master-detail tables. first one is master table; second one is detail table.
    When the web page loads all the table data is not fetched from the db (it will depend on the fetch size). when we scroll down the table data fetch happens again and again.
    think my data fetch size is 25 rows per time.
    Suppose we use mine poll method and think I have clicked on the 20 ^th^ row of table1(master table). then the table2 will display details belongs to selected department. that is OK even after refresh. that works well.
    when I go to 30 ^th^ row data fetch will happen (my fetch size = 25)
    when I click on the 30 ^th^ row of the table1(master table), table2 will display details belongs to selected department. but after the poll method is called the selected row at the table1 disappears and is set to another position. now the 30 ^th^ row is not in the 30 ^th^ position. but it is the selected row and table2 displays correct details.
    I think you have got the problem now. :D
    Thanks a lot.
    Dinuka.

  • Filter out two dates in Infopackage on the same field

    Hi!
    I have this code in a infoPackage that gives me the current month intervall (if not the day is the first of a month, then it gives me previous month ). I need to add a change to this code. I would like to also filter out the date '25001231' (this is a dummy for empthy values).
    So I need both the intervall (as it is defined in the code), and a spesific date.. I have tried but I can't get it to work. Please help
    Data: l_idx like sy-tabix,
            date_low1 like sy-datum,
            date_low2 like sy-datum,
            date_high1 like sy-datum,
            date_high2 like sy-datum,
            rep_date like sy-datum.
      rep_date = sy-datum.
      read table l_t_range with key
      fieldname = 'RESOLVED_DATE'.
      l_idx = sy-tabix.
    *If the date is not '01' in the current month the loading is started on,
    *this will be triggered.
      IF rep_date+6(2) <> '01'.
    *Here we define the first date in the range, day is always '01'.
        Date_low1 = rep_date.
        date_low1+6(2) = '01'.
    *Here we put in the date we have be given, and get out
    the last day of the month.
        CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
          EXPORTING
            DAY_IN            = Date_low1
          IMPORTING
            LAST_DAY_OF_MONTH = date_high1.
        Move date_low1 to L_T_Range-Low.
        Move date_high1 to L_T_Range-High.
        L_T_Range-Sign = 'I'.
        L_T_Range-Option = 'BT'.
        modify l_t_range index l_idx.
        p_subrc = 0.
    *If the date is '01' in the current month the loading is started on,
    *this will be triggered.
      Elseif rep_date+6(2) = '01'.
    *if the day is '01' we need to extract the previous month data.
        Date_low2 = rep_date - 1.
        date_low2+6(2) = '01'.
        CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
          EXPORTING
            DAY_IN            = Date_low2
          IMPORTING
            LAST_DAY_OF_MONTH = date_high2.
        Move date_low2 to L_T_Range-Low.
        Move date_high2 to L_T_Range-High.
        L_T_Range-Sign = 'I'.
        L_T_Range-Option = 'BT'.
        modify l_t_range index l_idx.
        p_subrc = 0.
      ENDIF.

    Hi Helge
    I verified the below in my system its working now.
    Data: l_idx like sy-tabix,
    date_low1 like sy-datum,
    date_low2 like sy-datum,
    date_high1 like sy-datum,
    date_high2 like sy-datum,
    rep_date like sy-datum.
    rep_date = sy-datum.
    *l_idx = sy-tabix.
    *If the date is not '01' in the current month the loading is started on,
    *this will be triggered.
    IF rep_date+6(2) ne '01'.
    *Here we define the first date in the range, day is always '01'.
    Date_low1 = rep_date.
    date_low1+6(2) = '01'.
    *Here we put in the date we have be given, and get out
    * the last day of the month.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
    EXPORTING
    DAY_IN = Date_low1
    IMPORTING
    LAST_DAY_OF_MONTH = date_high1.
    break sbhaskar.
    Move date_low1 to L_T_Range-Low.
    Move date_high1 to L_T_Range-High.
    L_T_Range-Sign = 'I'.
    L_T_Range-Option = 'BT'.
    modify l_t_range index sy-tabix.
    p_subrc = 0.
    *If the date is '01' in the current month the loading is started on,
    *this will be triggered.
    Elseif rep_date+6(2) = '01'.
    *if the day is '01' we need to extract the previous month data.
    Date_low2 = rep_date - 1.
    date_low2+6(2) = '01'.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
    EXPORTING
    DAY_IN = Date_low2
    IMPORTING
    LAST_DAY_OF_MONTH = date_high2.
    Move date_low2 to L_T_Range-Low.
    Move date_high2 to L_T_Range-High.
    L_T_Range-Sign = 'I'.
    L_T_Range-Option = 'BT'.
    modify l_t_range index sy-tabix.
    p_subrc = 0.
    ENDIF.

Maybe you are looking for

  • Inventory data not matching with R/3

    Hi, In R/3 production we have the data from 1999-Till date.From 1999-2004 Data was archieved in R/3 system.So we have two years live data in the R/3 production. We have filled the setup tables and extracted the Inventory data then loaded into 0IC_C03

  • Why does InDesign keep crashing when I scroll past a particular spread?

    If I scroll past it quickly its fine but when I try to scroll to it to edit it, it just freezes and then crashes. Please help!!! I am receiving the following error report: Process:               Adobe InDesign CS6 [3568] Path:                  /Appli

  • Doubt about Report:: Count users by domain

    Guys, when I run report: Count users by domain, display my domain XXX and some hostnames users logged in my domain and 15 users logged locally. Well,some users after 2 weeks already logged in domain but in my report still display info user logged loc

  • SocketException: Connection reset , using HttpURLConnection

    hello everybody, i'm using this to read a xml from internet:        URL url;             HttpURLConnection urlcon;             url = new URL (urlString);             System.out.print("Connecting ....\t");             urlcon = (HttpURLConnection)url.o

  • Labview 2010 icon editor extremely slow

    Working on a medium size project in LabVIEW 2010.  Out of the blue the icon editor slows down.  So slow that typing in one text character takes 20 seconds.  After closing the editor there is about 3 to 5 second lag on every action I make in LabVIEW.