GMT Calendar printing out time as IST

Can anyone tell me why the following is happening please. I know there are always people asking about dates/times/timezones etc but i haven't seen anyone with this problem. so i'll ask it.....
I'm creating a calendar with the GMT timezone. If the calendar is set to a date that is in daylight savings time it prints out the date with the timezone IST, but if the date is not in daylight savings time the date is GMT.
How can i make it print the date with GMT ?
I'm in Dublin, working on NT, with jdk1.3.1
here's the code snippets if it helps:
String time = "2003.08.13 AD 11:10:00.802 GMT";
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd G HH:mm:ss.SSS z");
Date temptime = sdf.parse(time);
cal.setTime(temptime );
temptime= cal.getTime();
System.out.println("temptime = "+temptime);
And here's the output:
Wed Aug 13 12:10:00 IST 2003

Hi "mazzam3",
If you look at the source code for the "SimpleDateFormat" class, you will see that it uses the default time zone. So even though you have ensured that your "Calendar" instance is using the correct time zone, your "SimpleDateFormat" instance is not. What I usually do is set the default time zone for the JVM before I start working with dates and times -- that way I know that all date and time related classes are using the same time zone. So I guess in your case, I suggest setting the default time zone to GMT.
Hope this helps.
Good Luck,
Avi.

Similar Messages

  • How to print out time as hr:min:sec without AM/PM?

    how to print out time as hr:min:sec without AM/PM
    since hr specifies AM/PM. Thank you. My first thought
    is that there exists a formatter to do this. My second
    thought is that if not I can convert the AM/PM in the
    DateFormat.MEDIUM to the right hour.

    import java.text.*;
    import java.util.*;
    public class Test {
        public static void main (String [] args) {
            SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
            Date d = new Date();
            System.out.println( format.format(d) );
    }

  • Calendar print out with telephone link

    Hi everyone!
    We have a strange calendar-print out Problem.
    We are running GW 2012SP2 on the Client and GW 2012sp1 on the backend.
    Default compose view is set to "plain text"
    If a User creates a posted appointment in plain text and writes a number
    (like a telephone number) in the message field with further
    text the number is converted to a kind of "telephone link". OK - but if
    we want to print out the calendar
    in "expandable day calendar" format with message content the output is
    not correct.
    Somtimes the code of the link is part of the output or the text after
    the "telephone link" is missing.
    Can anyone duplicate this?
    As a workaround we found either to compose the appointment in HTML or to
    delete the "telephone link" manually.
    Is this a known bug?
    thanks in advance
    Wolfgang

    Hi Wolfgang,
    Let me do some testing and see what I can come up with
    Cheers,

  • In setting up my ICal calendar I have specific times (as new events) that I want to be included in the print out.  This doesn't happen.

    In setting up my ICAL calendar I have specific times (as new events) for each day.  When it prints out the time does not show up (rather its a bar).  I would like the time for each appointment to print out. How do I do this?

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    Note if you have failed to move contacts and calendar items across you should create one dummy entry of each in your new profile and iTunes should  merge the existing data from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library or a backup then then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.
    tt2

  • How can I print out a daily, weekly and or monthly calendar?

    I am a busy person and find if I can print out my weekly calendar and have it nearby I can quickly plan my time better.
    Lorrene

    Assuminh your profile is correct that you are running OS X 10.5.8, you need the version of Pages from iWork 09.
    Try to find the CD for it on eBay
    Allan

  • TS4118 When I print out my ical calendars, there are three duplicate events happening every day of the week and I never entered this event?

    When I print out my calendars from ical, there is one event that is reoccurring 3x/day/every day of week! It is not showing on the actual calendar and I cannot figure out how or where it's coming from? It's in the calendar marked Jimmys action which just shows my sons activities and for this activitiy, I put one day with a recurring weekly on just two days of the week at a specific time and this is showing up as well and correctly? What should I do to remedy this?

    UPDATE: I think I found the answer to my problem. I travel between two time zones and recently started listing event times as "floating" so they don't get messed up when I travel between west and east coasts. It seems that when I want to print out a calendar sheet, the time of the event doesn't show up if it's a "floating" event. So, I need to go back to putting a time zone in and turning off "time support" in Preferences for iCal. BTW this (in reverse) is a solution for those who don't want to see appointment times printed out – make it a "floating" event.

  • How to use Applescript to print out a certain calendar at 7am every morning?

    Hey guys,
    I am trying to use AppleScript to print out one of my calendars each day at 7am every morning.
    I have come up with this so far:
    tell application "Calendar"
           view calendar "My Appointments" at (my (current date))
           switch view to day view
           activate
                        tell application "System Events"
                     keystroke "p" using command down
                     delay 1 -- (seconds)
                     tell process "Calendar"
                                                      tell window "Print"
                                                                     if value of checkbox "Calendar Keys" is not 0 then
                                      click checkbox "Calendar Keys"
                               end if
                                                      end tell
                                       end tell
                        end tell
    end tell
    The problem with this is that it will print out whatever calendars are currently viewable. I can't figure out how to tell it to deselect other calendars and just select the one I want. I also want to tell it to print this out at 7am every morning.
    Any help would be very appreciated!

    If you wanted to do the printout over multiple days, you would be best to loop through each day's events in the way the current script does, but to put a new loop around it that gets each new day's data:
    --opens a temporary file
    set fileRef to open for access ((path to desktop) as string) & "meetings.txt" with write permission
    --effectively empties the file
    set eof fileRef to 0
    tell application "Calendar"
              set dayCount to 9 --this will be the number of days to look forward (not including today)
              repeat with currentDay from 0 to dayCount
                        set startList to {}
      --get's today's date
      --set startRange to ((current date) + 12 * days) -- I used this for testing, to point to a day that had many appointments.  I've left it so you can use it, too.
                        set startRange to ((current date) + (currentDay * days))
      --set the start of the range to previous midnight
                        set hours of startRange to 0
                        set minutes of startRange to 0
                        set seconds of startRange to 0
      --set end of the range to next midnight
                        set endRange to (startRange + 1 * days)
      --get today's events
                        set todaysEvents to get (events of calendar "My Appointments" whose (start date is greater than startRange) and (end date is less than endRange))
      --make a new list with start time of the event for sort purposes
                        repeat with theEvent in todaysEvents
                                  set end of startList to {startdate:start date of theEvent, eventID:theEvent}
                        end repeat
      --sort using a bubble sort (suitable for short lists)
                        repeat with i from 1 to (count of startList) - 1
                                  repeat with j from i + 1 to count of startList
                                            if startdate of item j of startList < startdate of item i of startList then
                                                      set temp to item i of startList
                                                      set item i of startList to item j of startList
                                                      set item j of startList to temp
                                            end if
                                  end repeat
                        end repeat
      --empty the original list
                        set todaysEvents to {}
      --repopulate the list in correct chronological order
                        repeat with theEvent in startList
                                  set end of todaysEvents to eventID of theEvent
                        end repeat
      --write today's date to the file
      write (date string of startRange & return & return) to fileRef
      --if there are no events, write this to the file as well
                        if length of todaysEvents is 0 then
                                  write "No events" & return & return to fileRef
                        else
      --process each event into format: hh:mm-hh:mm/new line/event summary
                                  repeat with theEvent in todaysEvents
                                            set startdate to start date of theEvent
                                            set enddate to end date of theEvent
                                            set startHours to hours of startdate as string
                                            if length of startHours is 1 then set startHours to "0" & startHours
                                            set startMins to minutes of startdate as string
                                            if length of startMins is 1 then set startMins to "0" & startMins
                                            set starttime to startHours & ":" & startMins
                                            set endHours to hours of enddate as string
                                            if length of endHours is 1 then set endHours to "0" & endHours
                                            set endMins to minutes of enddate as string
                                            if length of endMins is 1 then set endMins to "0" & endMins
                                            set endTime to endHours & ":" & endMins
      --write the event to the file
                                            set theSummary to (starttime & "-" & endTime & return & summary of theEvent & return & return) as string
      write theSummary to fileRef
                                  end repeat
                        end if
      write return to fileRef
              end repeat
    end tell
    --close the file
    close access fileRef
    --print the file
    set theFile to (((path to desktop) as text) & "meetings.txt") as alias
    tell application "TextEdit"
              print theFile without print dialog
    end tell

  • Value not populating in the print out (sales order) for the 1st time

    Hi friends,
    While saving a sales order, the order confirmation going to the user is not populating the LDC field. LDC is Last date of change. This field can be found in the Additonal data 2 tab of the material in the sales order. When I enter a date in this field and save, the print preview of the output has this value, but the print out does not carry this value.
    Another weird thing about this issue is that, the second time i trigger the output, the print out has the value.
    Please give me some clue on where to check and how to go about fixing this problem.
    Regards,
    Shanu.

    Dear Shanu,
    This issue may be related bug in the output program so take help of ABAPer to fix the issue.
    I hope this will help you,
    Regards,
    Murali.

  • How do I print calendar with out any bug in

    I tried to print my calendar and every time it does not print my calendar the way I wrote it.  for exemple, if I put 3 names in one day and change the order the next day and so on and foward, it print it all mixe up and when I come back to the calendar, everything is OK like I wrote it.  I thing it is a bug in Ical but maybe somebody can tell me what I'm doing wrong.
    Thanks
    Clément Lapointe

    Please refer to this (extremely lengthy) thread, all possible options have been covered here: https://discussions.apple.com/thread/5460803?tstart=0

  • How can I print out a musical score?  Not just one track at a time.

    Hello,  I am a composer and I would like to print out a piece that will have piano, voice, and possibly other instruments on it.  So far I can only seem to print one track at a time rather than the whole piece.  I would REALLY appreciate any help!
    Thanks!
    -Kim

    No problem.  Finale's full software package is pretty expensive, but they offer a scaled-down $10 version called NotePad which will import MIDI files and print scores.  I'd suggest starting with that and seeing if it is sufficient:
    http://www.finalemusic.com/NotePad/default.aspx

  • How can I print out iCal monthly calendars for my planner?

    MacBook Pro 17"
    Intel chip
    OSX 9.6
    Is there any way to print out my iCal monthly pages to make my own planner book?
    I looked at a third party app called iPlanner and it purports to do what I want, but it's old and has mixed reviews. I cannot believe that there is not that function built into iCal. Please advise. Thanks you much.

    You should design you front panel to more closely match the aspect ratio of the paper.
    A possible solution would also be to create a special subVI with the desired print layout. Whenever you want to print, call it with the current display data and make sure to set it to "print when complete".
    LabVIEW Champion . Do more with less code and in less time .

  • How can I print out specific categories on my outlook calendar

    After downloading latest version of Icloud. I am not able to print out specific categories on icloud calendar

    I tried this Finder drag method & discovered that it is very important to set the blank TextEdit document to plain text before the drag (from the format menu or with Cmd-shift-t). If you don't, TextEdit attempts to load the content of the files!
    Once I discovered this, I tried the method with Find (Cmd-F) results & it works for that, too. This means that by choosing the right combination of search location(s) & search criteria, you can extend the method to filter the list to just about any files you want, which could be very handy.
    For instance, set the "Kind" criteria to "QuickTime Movie" & location to "Computer" & you get a list of every QT movie. Or set the search location to the folder containing the movies of interest & you get all of them, including ones in subfolders. You could also use the 'date created' or other search criteria to filter the list to a specific subset of movies (or whatever).
    If you need to do this often, you could create one or more 'Smart Folders' with the criteria preloaded for each search.
    The only drawback I see for either Finder based method is the full path one. If you are getting results from just one or a few folders, Find & Replace can delete any of the path name fairly easily, but it becomes a chore if there are a lot of different ones. Some other text editor, like TexEdit Pro, that supports grep searches would be handy here, but since I'm not up to speed on grep, someone else will have to explain how to use it for this, if they want.

  • How can i print out calendars ...

    I have a mac that cannont carry lion so I cannont access icloud except on the web site. Still, I need to be able to print out calendars the way I did with icalendar. Is there a way of doing that?

    http://guides.macrumors.com/Taking_Screenshots_in_Mac_OS_X
    Print them as you would any other document, by choosing Print from the File menu in whatever program you use.

  • In po,every time i want to add the message for print out.

    in po,every time i want to add the message for print out.
    is there any permanent solution for above issues ?

    Hi,
    1) use transaction nace
    2)Select application EF  and go to condition records
    3) o/p type is neu , select the same and double click on it .
    4) select paricular condition table.
    5) maintain condition records , means for particular combination NEU should appear automatically in PO print.

  • Print out of RFQ with One Time Vendor

    My customer wants print out of RFQs with one time vendor.
    As per my understandings as like other vendors this one time vendor data is not stored in any table.This data is in table ADRC. And for one time vendor no master data is there.I can see this one time address in particular RFQ.
    Now, my customer wants this one time vendor address to be printed in all RFQs.
    Is any body come across this scenario ever ?Please guide my it is urgent.
    With Best Regards,
    Rajesh

    Hi,
    The vedor(OTV or Regular vendor) will be decided after the price comparision only.
    Once the OTV (account group:CPD/CPDL) is finalised as the final vendor for procurement create a new vendor master record (With A/c group:0001) and maintain Inforecord and source list and create PO.
    Maintain all the conditions in the Inforecord from the quotations (you have the update info option from price comparision itself)
    regards,
    Kannaiah Naidu

Maybe you are looking for

  • When i editing in the piano roll windows, after 10 at 20 editing steps my logic pro 9 crashed down. Every time. Is this a bug?

    When i editing in the piano roll windows, after 10 at 20 editing steps my logic pro 9 crashed down. Every time. Is this a bug?

  • Fix damaged Indesign CC file

    Something happened to my indesign file and after clearing my cache and preferences, the file will still not open. When I try and open the file Indesign will open normally, then after about 30 seconds close completely. Upon reopening, I get the error

  • Aperture Vault or Time Machine

    I just migrated from being a long time Windows user (and using Lightroom) to my first iMac and Aperture. Just beginning to import my images into Aperture and had read a few posts about "vault" which I assume is Aperture's way of backing up either it'

  • How fragile is the Macbook Air

    This is a rather silly question... If my cat likes sitting on top of my closed macbook air do you think it can handle that kind of weight/ pressure?  It just seems so fragile.  Thanks!

  • Issue of Output

    Dear All In performa invoice,there is one issue that in output,there is only a address of Plant not the city.I need to add city. can you plz suggest me that how i will rectify this? Many Thanks Rakesh Naveen