SimpleDateFormat and TimeZone; is: +0200 but must be +02:00

Hello,
running this code ...
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
System.out.println(sdf.format(new Date()));... outputs this line as expected ...
2008-07-24T18:59:58+0200... but what i actually need is ...
2008-07-24T18:59:58+02:00Note the additional colon in the time zone output: +02*:*00. How to get that format as described in http://www.w3.org/TR/NOTE-datetime ?
Thanks!

nclow wrote:
CapM wrote:
Yes, but it also added a "GMT", which is not allowed by the remote side (i need to format XML that follows certain restrictions).Then your problem has just become a bit larger. Read the difference between the z and the Z symbol in the sdf API documentation. What will you do when your timezone output is "EDT" as it is for me? You can't put a colon in that. You may have to do further parsing with a Z symbol to eliminate text from that output and just keep the numbers. You might want to just do a new SimpleDateFormat("Z") and then pass that to a custom parser which will manipulate it according to your requirements, then append it later.Well, i guess that one is graceful and pragmatic enough. Thanks for your suggestions @ all!

Similar Messages

  • SimpleDateFormat and TimeZone problem

    Hi all, I know there have been a lot of questions
    concerning this topic, but I've looked over a lot
    of messages and I think I've used all ideas provided,
    yet still I can't fix my problem.
    My problem concerns parsing a date from a HTTP
    packet. I use the following code:
    SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss zzz");
    sdf.setTimeZone(TimeZone.getDefault());
    Date date = sdf.parse(packet.substring(exp_pos+9, endline));Most of the time this code works perfectly, however
    from time to time the parse result is 12 hours of.
    Instead of 14h the result is 2h. HTTP dates use a
    24 hour time.
    I'm using the JVM by Blackdown, version 1.3.1 on
    Debian Linux 2.2.18. The timezone is configured
    correctly in my os. I'm in GMT+1.
    I'm not sure if this is a bug or if I have done something
    wrong.
    Any help would be greatly appreciated.
    Peter

    Looks to me that your time format with lower-case "hh" tells it to use the 12-hour, not 24-hour format, and you're not including the am/pm indicator. So it's doing just what you're telling it to do. If you want 24-hour format, use "HH" instead of "hh".

  • When I click to open firefox it says that "firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system" and I've tried to shut down and restart my computer but it keeps

    when i click to open firefox it says that "firefox is already running but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system." and I've tried to shut down and restart my computer but it keeps showing the same message. I've even uninstalled Firefox and then reinstalled in the hopes that the problem would be solved but it this message is still popping up. What can I do to solve this problem?
    == This happened ==
    Just once or twice
    == I was on facebook trying to upload pictures yesterday. ==
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; InfoPath.1)

    Do you have a profile lock file in your profile folder? If so, delete it and see if TB runs properly:
    http://kb.mozillazine.org/Profile_in_use#Remove_the_profile_lock_file

  • TS1646 hello  I have problem with regist my visa and I cannot buy from store the message came in the end of form is says the phone number must be a 7-digit number and I have writed but not accepted iam from saudi arabia my mobile is 966504850992 pls answe

    hello 
    I have problem with regist my visa and I cannot buy from store
    the message came in the end of form is says
    the phone number must be a 7-digit number
    and I have writed but not accepted
    iam from saudi arabia
    my mobile is 966504850992
    pls answer
    thanks
    dfr aldossary

    Wow, Karan Taneja, you've just embarrassed yourself on a worldwide support forum.  Not only is your post ridiculous and completely inappropriate for a technical support forum, but it also shows your ignorance as to whom you think the audience is.  Apple is not here.  It's users, like you. 
    If you would have spent half the time actually reading the Terms of Use of this forum that YOU agreed to by signing up to post, as you did composing that usesless, inappropriate post, you (and the rest of us on this forum) would have been much better off.

  • My sons iPhone 5c is disabled, it says connect to iTunes, when we do that it says do you trust this computer and then it says you must confirm this on your phone, but I can't because it is disabled

    my sons iPhone 5c is disabled, it says connect to iTunes, when we do that it says do you trust this computer and then it says you must confirm this on your phone, but I can't because it is disabled

    http://support.apple.com/kb/ht1212
    Look at the section titled:
    If you have never synced your device with iTunes

  • My iWeb image names are incompatible with FTP servers and must be renamed but I can't find the images in iWeb. I can upload to a desktop file and change them there but then I would need to download them to a new site in iWeb to publish them.

    my iWeb image names are incompatible with FTP servers and must be renamed but I can't find the images in iWeb. I can upload to a desktop file and change them there but then I would need to download them to a new site in iWeb to publish them. 
    What's the answer?
    Thanks 

    Many thanks to  responded to my question and sorry not to get back sooner.
    Yes, I discovered by this unfortunate experience that the names of photos are a serious issue if the site is to ever go to an FTP server.  Apple should discuss this carefully in their "manual".
    One more question:  I uploaded the website to a folder on my desktop. When I open it, unlike the photos in iWeb, there are folders for each page which have all the photos in them. I went through each folder and changed the names to be FTP compatible. I'm using iWeb SEO Tool which allows one to upload from this local folder to an FTP server but having trouble.
    Is this because there is an imbedment in iWeb that uses the old photo names to link to the actual photos and it can't find them because of the name changes?
    Thanks again for your help ...
    Phil McP

  • HT201210 I tried to update my ipad through wifi and followed the steps. It says that update is complete however i must connect to itunes and restore the updates but itines says i dont have permission to do so. KIndly assist on the stages to follow. Screen

    I tried to update my ipad through wifi and followed the steps. It says that update is complete however i must connect to itunes and restore the updates but itines says i dont have permission to do so. KIndly assist on the stages to follow. Screen is black ad i unable to work on it.
    Kindly give some suggestions
    Regards
    Banzi

    Hello Mayanii,
    This display and behavior indicates that the iPad is in recovery mode and must be restored.
    If you can't update or restore your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT1808
    Cheers,
    Allen

  • Anyone else have a problem printing from an iMac OS-X 10.9.3 to a wireless Epson Artisan printer? Sometimes it prints but must often I get "The printer is not connected" and I have to retry printing 8, 10 or 12 times before it will print?

    Anyone else have a problem printing from an iMac OS-X 10.9.3 to a wireless Epson 835 Artisan printer? Sometimes it prints but must often I get "The printer is not connected" and I have to retry printing 8, 10 or 12 times before it will print? I have followed all the instructions from Epson about upgrading, etc. but it is very frustrating when I have to repeatedly try to print. Epson says talk to Apple???

    Try checking thru these, maybe some help.
    Mac OS X: How to reset the printing system
    http://www.macworld.com/article/2029528/mac-troubleshooting-what-to-do-when-you- cant-print.html
    Also try deleting the printer from your printer Q system preferences, then reinstalling it (highlight the printer click the minus symbol, then click the plus symbol and add it again. Reboot, and try.

  • HT1212 I can't access my iPhone 5s because I forgot my passcode. I tried restoring it and backing it up, but it says I must disable the app "Find my iPhone" but the thing is I can't access my iPhone 5s to disable my Find my iPhone app. Please help me out

    I can't access my iPhone 5s because I forgot my passcode. I tried restoring it and backing it up, but it says I must disable the app "Find my iPhone" but the thing is I can't access my iPhone 5s to disable my Find my iPhone app. Please help me out ASAP!

    You're going to want to force it in recover mode thent o restore the device, unplug it from the computer, hold down the home button replug it back in intil you see the Itunes symbol with an arrow pointing towards it
    HEre
    https://support.apple.com/kb/HT1808

  • HT2492 I am using Snow Leopard and the icon for dashboard was removed from the dock.  Does anyone knopw how to put it back?  I have searched Finder, Trash and the Applications folder but i can't find it.  It works when i press F4 so it must still be there

    I have searched Finder, Trash and the applications folder but i can't find where it is kept.  I want to put the icon for Dashboard back in the dock - how can i do this?

    The combo update may replace anything you have inadvertently deleted.
    Mac OS X 10.6.8 Update Combo v1.1
    You can reapply it over the top of any previously downloaded version.  I see that your profile says 10.6.8.
    Then software update to pick up any new security, iTunes updates.

  • I just bought this iPad today any I set up my iTunes account and I purchased a app store card and a iTunes card but when I try to dowload stuff it won't let me what's the problem

    Need help please I just bought this iPad today and I factory reset it and then I plugged into my laptop and downloaded the latest software I went and purchased a app store card and a iTunes card but when I try to download apps it won't let me if anyone can help with this problem it would be greatly appreciated. Thanks in advance. Antawn

    Hello Tntingey,
    The gift card you've given your father must be redeemed via the steps below.
    Redeeming iTunes Gift Cards and content codes
    http://support.apple.com/en-us/HT201209
    Cheers,
    Allen

  • I have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me

    i have problem with my wifi in 4 S, i cant connect to any wifi itried resetting network setting and reset all setting but the result was the same, its only keeps searching for wifi and cant find any, itried to use OTHER but also didnt work.please help me???

    If Join was on then your home wi-fi must be set to Non-Broadcast.  If you did not set this up (maybe your provider did) then you will need to find the Network Name they used, and any password they used.  The SSID is Security Set ID and to see more try http://en.wikipedia.org/wiki/SSID .  Basically it is the name used to identify your router/network.  A lot of times the installer will leave it set as LinkSys, or Broadcom or whatever the manufacturer set it as for default.  Your best bet is to get whoever installed it to walk you through how they set it up, giving you id's and passwords so you can get in.  HOWEVER, if you are not comfortable with this (if you set security wrong, etc.) you would be well ahead of the game to hire a local computer tech (networking) to get this working for you.  You can also contact the vendor of your router and get help (if it is still in warranty), or at least get copies of the manuals as pdf files.  Sorry I can't give you more help, I hope this gives you an idea where to go from here to find more.

  • When I export a playlist and then open in excel, do whatever sorting I want, I then save the file and reimport into itunes but not all the songs are there. It appears to be from "comma's" in the song name. Any solutions?

    I see songs such as "Monday, Monday" or "Paint It, Black" or even the artist name such as "Fireballs, with Jimmy Gilmer" which have comma's in them, being a problem when I try to do the following:
    1. Export a playlist which contains songs which are all there and play fine, but some have comma's in the title such as listed above.
    2. I then open that file in Excel and bring it in as a Tab-delimited file.  Everything lays out fine, and all the songs are thing (including those with comma's).
    3. I then sort the varoius fields I want (which I can't do in i-tunes because i-tunes won't sort it properly), and resave the file as a newly named file, which is also a .txt file.
    4. I then import that playlist into my itunes. It is exactly the same songs that I just had exported but i-tunes says some of the songs can't be found.
    I have traced this problem to comma's in the file name of the song such as listed above.  There must be a solution to this either as the file is opened in excel or in how it's saved or some other solution short of having to rename song/artists without using comma's. 
    Thanks.

    The additional problem is the file name of the song itself.  Even if I were able to delete the commas or replace with a space for example, changing the file name would result in itunes not being able to find the file.  I would have to go through each file (out of about 15,000+ songs) to find any that have titles such as described in this thread and change not only the song and artist in the fields, but changing the mp3 file itself. 
    I fear that I am really pretty much going to have to start with a list of songs that have no comma and then do a file compare to find those songs with commas and then just physically moving them into a new playlist I'm trying to create, but this is a royal pain as I want to be able to create a variety of playlists based on these chart dates/peak positions. 
    I'm trying to sort the songs in this manner:  I use different fields in itunes so that I can put the "peak position" of each song based on Billboard charts, as well as the date the peak position was acheived. I use the "comment box" for that.  I use the "grouping" field for my peak position.
    So I end up with something like "10/14/1980" in the comment box as the peak position for a song which is in the grouping field, and so forth.  If I try to sort the comments column in itunes for example, it won't sort properly. If I sort the Grouping field, it will bring up all the "1's", but that's followed by "10", 11, ...19, then "2", etc.  This is why I want to export the playlist and sort it as I want, and then reimport the playlist into itunes. 
    What I'm ultimately trying to achieve is a year-by-year peak position playlist so that I end up with every #1 song (in this case) from, say, January 1st 1980 and then every #1 song in sequential order for the rest of the year falls in line.  I have chart position dates from 1955 through 1999.  I have entered in all the data from Billboard books I own so I can really create some amazing playlists, but these commas are problematic. Had I known this ahead of time I would have made "Monday, Monday" as "Monday Monday" and not included commas, but it's too late for that.
    Any suggestions?

  • Setup problem, windows xp, firefox upgrade to 4 and asked to reboot but did not progress. keeps asking to restart even if I try to remove

    setup problem, windows xp, firefox upgrade to 4 and asked to reboot but did not progress. keeps asking to restart even if I try to remove

    Hi marsano,
    Usually the only reason it will ask you to reboot is if there is a file that must be modified that the updater doesn't currently have access to. You should try running the Firefox program once as Administrator:
    * Right-click the icon and choose ''Run as Administrator''
    If that doesn't help then do a clean reinstall.
    # Download a fresh copy of Firefox from the [http://www.mozilla.org/firefox/fx/ Mozilla download page] and save the file to the desktop.
    # [[Uninstalling Firefox|Uninstall]] your current version of Firefox and remove the Firefox program folder before running the new installer.
    # Run installer
    Remember that you don't want to remove personal data when uninstalling. That way you'll still have your personal information.
    Hopefully this helps!

  • All emails pushes to Iphone5 and the online iCloud, but certain e-mails won't push to iPad.

    Recently I did some switching around of my e-mails.  I have three Gmail accounts, forwarded to a fourth Gmail account.  This fourth Gmail account forwards all emails to Apple ID#1, and I have another Apple ID (ID#2), which I forward back to Apple ID#1.  So in essence, all 5 e-mail accounts gets forwarded to apple ID#1. 
    A situation occurred to me this morning that concerns me.  I have an iPhone5, and the iCloud webpage up and running.  At this particular point in time I was using my iPad2, and noticed that my iPhone5 and the iCloud webpage on my Windows 7 Laptop received an e-mail, where it immeidatley made all sorts of chimes and bells annoucing the new e-mail.  I expected it to occur on my iPad where several minutes passed and still nothing.  So I opened the e-mal client on the iPad2 and and it immediately refreshed my email, and still nothing, but it did update an existing email that I had starred as VIP while in the online iCloud earlier.  I didn't delete the e-mail from any of the e-mail clients just to make sure it had time to push to each device.  I checked all settings on my iPad and this all worked like a charm before I went to bed last night.
    These are my personal and home business related emails, so I must get these to pay my bills.
    Q:   Is there a history of iCloud not pushing to some or all devices?  
    Q:   Should I revert back to Gmail for more stability until Apple can get it together?
    Q:   Is there anything I can do to guarantee I get e-mails pushed to ALL my devices (iPhone5, iPad2, Online Based iCloud, and a 27" iMac (buying next week))? 

    Having received an e-mail after this posting, it correctly pushed to all devices. 
    Unfortunately, I got an expected e-mail from Craigslist to my primary Gmail account, which correctly forwarded to Apple ID#1, which correctly pushed to my iPad2, and to my iPhone5, but not to my online iCloud service on my Windows 7 Based Laptop.  As I write this, I'm still trying to refresh the page, and still, no e-mail.  There never is or becomes a record of it on the random device it won't push to, as I still don't have that e-mail on my iPad from this morning. 
    Let me rephrase the questions into one question:
    Q:  Why am I not getting ALL e-mails to ALL devices ALL the time?  Instead I'm getting ALL e-mails to SOME devices (random to which one) ALL of the time? 
    (I'm not yelling in CAPS, I'm just trying to point out the key words in my question.)
    If this keeps up, I'm going to have no choice but to revert back to Google, even when I buy my new iMac next week.  I print business cards for myself next week, and if I can't commit my e-mail address to apple 100%, I will have no other choice but to avoid Apple e-mail clients now, and in the future unless I want to change my address, which clients are reluctant to update as it is.  So as far as I see it, my address can never change once established. 

Maybe you are looking for

  • Format for fields in an internal table

    DATA: BEGIN OF ITAB OCCURS 0,   AUFNR  LIKE AFKO-AUFNR,  " Purchase Order Number   PLNBEZ LIKE AFKO-PLNBEZ, " Part Number   BISMT  like MARA-BISMT, " Old Material   LNO(2),   GAMNG LIKE AFKO-GAMNG, " Production Order Quantity   GLTRP  LIKE AFKO-GLTRP

  • App Store quirks / feature requests

    Some really annoying things about the App Store that really should have been addressed by now: 1. Why does the App Store close when you install an app?  If you want to install more than one app this is really annoying; especially if you have many pag

  • In Adobe Photshop 6.0 how can I browse files ?

    I used to have Adobe photo elements now I have 6.0 and I would like to browse photo files like I used too with elements but I can't find a way to do this. I typically have 10 to 15 photos that all need a quick edit, rename done to them and the browse

  • PLEASE ! itunes wont update ipod

    itunes wont automatically update my ipod touch 2nd gen so i need the file it is running on 2.2.1 HELP !! PLEASE !

  • Reg Missing Field Validation Message

    Hello All, I am trying to use field validation for making a field required when a specific value from a pick list is chosen, i am using this with a custom object. i have written the Field Validation: IIf(([<plStatus_of_Search_ITAG>] = 'Completed' AND