How to covernt a date/time to another time zone?

The current system (Unix) is what I'm running programs on.
When I get the current date and time it is in GMT time.
I tried to create a new Calendar and specify TimeZone.getTimeZone("EST") then use the getTime() function to get my Date, but that still displaed it in GMT time.

java.util.Date and java.util.Calendar have no real concept of Timezone, they only know about GMT. They store the number of ms since January 1, 1970 00:00:00.000 GMT. When you display a value you use a Timezone to work out how the time should be calculated.
For example -
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
public class Test20041116
    public static void main(String[] args)
        Date now = new Date();
        SimpleDateFormat local = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss z");
        System.out.println("Local time (Here) = " + local.format(now));
        local.setTimeZone(TimeZone.getTimeZone("EST"));
        System.out.println("Local time (EST)  = " + local.format(now));
        local.setTimeZone(TimeZone.getTimeZone("PST"));
        System.out.println("Local time (PST)  = " + local.format(now));
}

Similar Messages

  • Can u give clear steps how to load 3 data target at a time by the help of p

    can u give clear steps how to load 3 data target at a time by the help of parllalesim

    hi,
    create the load infopackage type and give the infopack you need to load.
    create 3 similar process types.
    chain should have this flow
    start -> delet index(if cube is the target) -> load target(connect the load process to start process) parallel -> and process -> create index(if cube)/actiavtion of ods(if ods)
    Ramesh

  • How do I insert a section with another time signature than the one im inser

    How do I insert a section with another time signature than the one im inser

    Yeah I've been trying to figure this out as well, for example... my song might be 90 bpm and I want to program another track using midi but have it play at 180 bpm. The only way I've found to work around this is to write my 180 bpm part make a sample of this and then loop this into the 90 bpm song.

  • How do you make an appointment in another time zone with IOS7?

    How do you make an appointment in another time zone with IOS7?

    Not clear how you want to set them - in your time zone or "another" time zone.
    Settings > Mail, Contacts, Calendars > (scroll down to Calendars) > Time Zone Support > ON/OFF (depending on how you want it)

  • How to call two data blocks at a time.

    hi all
    i want to call two data blocks at a time on function when button pressed.
    how can I it?
    many thanks

    Many thanks that you people reply,
    I am working in oracle form developer 6i and database 10g.
    I have a form that have three data blocks,
    first block have text boxes and search button,and next two blocks display records on the basis of search criteria that is inserted in the first block and when is clicked on save button.
    the data that is to b displayed is from two different tables.
    i used Go_block('my_block')
    and call other block with the same method.
    kindly guide me how can i do it.
    Thanks in advance

  • How to read updated data from a real-time generated file?

    I have a question:
    I want to read the 10 mostly updated data from a real time generated data file. The data in this file is accumulated. how can i read mostly recently data to an applet? and further to using this data to draw a real-time graph? pls help
    kelvin t.l. tse

    Hi,
    I think there is no "typical" way. You will have to define a convention on how the new data are stored into the file, so as to know how to accessthem. If new data are simply put at theend of your file, you may use a RandomAccessFile to read only those lines that interest you (the 1 final lines).Otherwise, you should at least know how the data file is written.
    You can know if thedata file has been modified with the File.lastModified() method. This retrurns a long value corresponding to the date and hour the file was last modified. Store that value ito you appl. and perdiodically (use a Thread), compare that value with the value returned by lastModief(). If both value are NOt equal, then the file has been updated
    it's all a question of knowing how the data are stored into the datafie generated.
    Be also aware that you will probably have problem when your java appl. tries to read the file at the same time it is updated by the other application. I guess when theother application writes data into the file, you will not be able to read it. So, use try{} catch statements and first check to see if you can read the file with File. canRead(). If not, simply delay the reading process by asking a Thread.yield() or Thread.delay (1000)...
    vincent

  • How to avoid: Material data locked by another user

    Hi,
    'Material data locked by another user'
    We want to avoid this kind of situation  so that two different users can do the transactions on same material at same time.
    Regards,

    hi,
    As per SAP std. configuration its not possible...And if we the reason...then it good for a user...
    so, that once the user 1's work is not done fully user 2 can't work untill then and by this we avoid making of extra GR/IR or any of the duplicate documents...
    Regards
    Priyanka.P

  • How to change the date generate absence quota(Time Evaluation)

    Hi all experts,
    Currently system use Time Evaluation, and generate absece quota in last day of month.
    So any way to change that system will use differ day to generate absence quota?
    Example use day 28 of each month will generate absence quota? Have any enhacement or configuration?
    Thank you,

    Tatsuya,
    there 2 better solutions for this, one is Generate Period Parameters and according accordingly the month end date you follow and use the same period parameter in V_T559L table to your Quota.
    and other Solutions is Write a PCR like Below.
    ABCD     (PCR Name)
       varstcrumo
            Varstreday
                 28
                   hrs=1
                   adddbTIME (TIME - Daily Time type - Create it in V_t555a table)
    Save it and go to TM04 Schema, and put this PCR with Function ACTIO and make sure to insert this before QUOTA Function and Before CUMBT. and save it, and dont forget to put TIME Time to your Base entitlement.
    you can run Time Evaluation to test it...let me know how it worked.

  • Sales Order - How to make Delivery Date default to Lead Time?

    My scenario is this:
    - We have items that go thru several production stages before it is a finished item that can be sold.
    - Each production item has its lead time loaded.
    - I would like the delivery date of a finished item to equal the sum of the productions items lead times.
    I dont want my sales people to have to look at calendars are calculate how long until something is ready for delivery.
    I would like my sales orders delivery date to default to a date that sales people can use.
    Is this possible? I would think this would be part of core functionality but I do not see this.
    Thank you,
    John Sefton

    John,
    Knowing what Items are added to the Sales Order at the time of entry would not be possible without SDK since the line level details are stored internally in temp location.
    Only on Submitting the Sales Order would it be possible to calculate the date.
    Let me know how you would want to move on this
    Suda

  • How do I remove [date].inprogress image from Time Machine image?

    I had a restart on my time machine during the back-up. Since, then all back-ups fail. I think it has to do with the temp file that is created named [backup date and time].inprogress. Regardless, all the files are protected and cannot be deleted. I tried changing permissions, but that is not allowed. All fails.
    Any guidance is much appreciated.
    I am using Yosemite 10.10.2.
    Thanks,
    Baba

    Open Time Machine preferences, click on the Options button. At the bottom of the exclusion list click on the Add [-] button, select the drive in the File dialog, click on the Exclude button. Understand that this configuration will only remain as long as the drive remains mounted.

  • How to merge existing itunes library with another time machine volume?

    hi all,
    i am 2 macs, an iMac and a MacBook - both running Snow Leopard 10.6.3 and both running itunes 9.
    is possible to merge the itunes library on the MacBook onto the iMac via my MacBook's Time Machine volume? i do not have my MacBook with me at this moment cos' i have sent it for diagnostic and repair. i have the latest itunes library backups on my MacBook's Time Machine.
    hope to hear some valuable pointers. Thank you!

    mook73 wrote:
    is possible to merge the itunes library on the MacBook onto the iMac via my MacBook's Time Machine volume?
    i have never attempted such an operation, so no step-by-step guide !
    you will be able to restore the other Mac's library to the iMac. go here and follow the instructions: http://web.me.com/pondini/Time_Machine/17.html. restore whatever you need to a temporary location, i.e. the desktop.
    if you only want the media files, just restore the iTunes music folder. when restored, use +add to library+ from the file menu or just drag the folder you restored to the +automatically add to iTunes+ folder inside the iTunes folder.
    if you also want playlists, playcounts, and ratings, you should restore the entire iTunes folder.
    take a look @ PowerTunes. this app should enable you to merge the two libraries.
    good luck !
    JGG

  • How can I import data from history including time of visit to site?

    When I open my "History" tab I can then select from the left hand column, for example "last seven days" and then select "copy" from the "Organize" tab. But when I paste into an Excel worksheet, the only information that shows up is the website. Is there a way to also import the "visit date" column?

    You would have to use an extension like SQLite Manager to export the history as CSV.
    *[[/questions/835204]]
    You can add other columns when needed.

  • How do I move data on time machine from one external hard drive to another

    How do I move data on time machine from one external hard drive to another?

    Although the documentation says you can copy Time Machine backups in the Finder, it's very slow and sometimes doesn't work at all.
    Launch Disk Utility, open the built-in help, and search for the term "Duplicate." Follow the instructions. Turn Time Machine OFF in its preference pane while copying the volume.

  • How do I transfer data from one iPhone to another?

    How do I transfer data from one iPhone to another?

    If your old device is an Apple using iOS 5 or later, and you have an iCloud account, you can transfer all your saved messages, email accounts, photos, notes, and other personal settings to your new iPhone.
    Here's how...
    Connect your old Apple device to WiFi and to a power source.
    Back it up to iCloud by going to Settings > iCloud > Storage & Backup and toggling iCloud Backup on. The time it takes to ba ckup depends on how much data you have and on the speed of your internet connection.
    iCloud backs up your device once a day. If it needs backing up before you transfer to your new iPhone 5, tap Back Up Now in Settings > iCloud > Storage & Backup. Do not start transferring before the backup is finished.
    Turn on your new iPhone and complete the setup by selecting your language and country, and choose whether to enable Location Services. When prompted, choose your WiFi network.
    When prompted to set up, choose Restore from iCloud Backup, tap Next, and enter your Apple ID and password.
    Select the backup of your old device and tap Restore. Wait until the device has finished restoring from the backup.
    When the restore process is complete, your iPhone will restart and be ready to use.
    Connect your iPhone 5 to iTunes to sync data not contained in the backup (such as music, videos, apps, and so on). You can choose the data that are synced by clicking the syncing tabs in iTunes.

  • How can I do to acquire and save date in the same time and in the same file when I run continual my VI without interrupti​on.

    I've attached a VI that I am using to acquire amplitude from Spectrum analyzerse. I tried to connect amplitude ouput to the VI Write Characters To File.vi and Write to Spreadsheet File.vi. Unfortunately when I run continual this VI without interruption, labview ask me many time to enter a new file name to save a new value.
    So, How can I do to aquire and save date in the same time and in the same file when I run continual my VI for example during 10 min.
    Thank you in advance.
    Regards,
    Attachments:
    HP8563E_Query_Amplitude.vi ‏37 KB

    Hi,
    Your VI does work perfectly. Unfortunately this not what I want to do. I've made error in my last comment. I am so sorry for this.
    So I explain to you again what I want to do exactly. I want to acquire amplitude along road by my vehicle. I want to use wheel signal coming from vehicle to measure distance along road. Then I acquire 1 amplitude each 60 inches from spectrum analyzer.
    I acquire from PC parallel port a coded wheel signal coming from vehicle (each period of the signal corresponds to 12 Inches). Figure attached shows the numeric signal coming from vehicle, and the corresponding values “120” and “88” that I can read from In Port vi.
    So I want to acquire 1 time amplitude from spectrum analyser each 5
    period of the signal that I am acquiring from parallel port.
    So fist I have to find how can I count the number of period from reading the values “120” and “88” that I am acquiring from In Port (I don’t know the way to count a number of period from reading values “120” and “88”).
    Here is a new algorithm.
    1) i=0 (counter: number of period)
    2) I read value from In Port
    3) If I acquire a period
    i= i+1 (another period)
    4) If i is multiple of 5 (If I read 5 period)
    acquire 1 time amplitude and write to the same
    file this amplitude and the corresponding distance
    Distance = 12*i). Remember each period of signal
    Corresponds to 12 Inches).i has to take these
    values: 5,10,15,20,25,35,40,45,50,55,60............
    5) Back to 2 if not stop.
    Thank you very much for helping me.
    Regards,
    Attachments:
    Acquire_Amplitude_00.vi ‏59 KB
    Figure_Algorithm.doc ‏26 KB

Maybe you are looking for

  • Photoshop CC keeps needing to update

    Several hours after I install the Photoshop CC update the creative cloud app tells me I need to update it gain. There are no errors messages, after each update it says it's sucessful, but it always comes back. I'm using OSX 10.8

  • Need help recovering files

    Adobe Reader could not open 'f1065sk1.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded). This is the error message I keep getting wh

  • Standard procedure to do repartitioning !

    Hi I have an infocube and I want to repartition it. Now what standard procedure I should follow considering I want to make a back up of the Infocube. To make the backup infocube I cant use the cubes data as it is aggregated. Should I use the DSO to m

  • G5 locks up when logging out and other concern

    This has become a problem over the past year. I know that it is an old single processor, first of the Power Macs, legacy machine and OS. I have gone through all various check system/disk evolutions with Apple and TechTool Utilities. Also, when I have

  • What does IO Exception "Server Certificate subjectDN CommonName received does not match Server hostname" mean?

    While trying to establish a SSL Link to a URL Connection, I got an IO Exception "Server Certificate subjectDN CommonName received does not match Server hostname" on the destConn.getOutputStream(). What does this mean? And how do I fix it? System.setP