How can i get todays date as an yyyy-MM-dd format instead of Time stamp

how can i get todays date as an yyyy-MM-dd format instead of Time stamp,i try to do it in the fallowing way
<code>
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
     java.util.Date d = new java.util.Date();
          String s = d+"";
Calendar cal1 = Calendar.getInstance();
     try{
     cal1.setTime(sdf.parse(s));
}catch(Exception e){}
</code>
but i could not able to get,it throws error as an java.text.ParseException: Unparseable date: "Thu Jan 24 11:43:32 EST 2002" ,pl suggest me any solution.any help would be appreciated.
Regards.

Does string s have to end with ""?
Try doing sdf.format(d) instead.

Similar Messages

  • How can I get the date of the next monday from the currentday?

    How can  I get the date of the next monday from current day? Please advice.
    mayooran99

    Hi mayooran,
    Please try the following code
    DateTime nextMonday = DateTime.Today.AddDays(((int)DateTime.Today.DayOfWeek - (int)DayOfWeek.Monday) + 7);
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • My battery died and then when i charged the phone it is asking me to connect to itunes and restore. if i restore how can i get my data back

    My iphone battery died and on charging the phone it asked me to connect to itunes and restore the phone.
    If i restore the phone how can i get my data back and how can i check when i last backed up my phone

    If you have been syncing regularly as the iphone is designed, then you can sync the data back.
    Regardless you will have to restore the iphone.

  • I lost my iPhone device, how can I get my data back on another one without using an iCloud backup just back up on i Tunes, Please Help.

    I lost my iPhone device, how can I get my data back on another one without using an iCloud backup just back up on i Tunes, Please Help.??

    You can find the backup files and then copy them to a safe place if you are worrying about this.
    iTunes places the backup files in these places:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    The "~" represents your Home folder. If you don't see Library in your Home folder, hold Option and click the Go menu.
    Windows Vista, Windows 7, and Windows 8: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    To quickly access the AppData folder, click Start. In the search bar, type %appdata%, then press Return.
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    To quickly access the Application Data folder, click Start, then choose Run. In the search bar, type %appdata%, then click OK.

  • How Can we get the data from Non-SAP to SAP in WebDynpro

    Hi,
    I hope u understand my query, How can we get the data from Non-SAP to SAP thru WebDynpro Programming.
    Help out with the steps for getting the data or procedure.
    Regards,
    Mutyapu

    You can expose the APIs in the Non-SAP backend as Web Services, and consume them in SAP by creating an Enterprise Proxy. Then these can be called just like normal class methods from Web Dynpro.
    Regards,
    Nithya

  • How can I get a date picker or wheel to show up in the form to make filling in a form with a lot of

    how can I get a date picker or wheel to show up in the form to make filling in a form with a lot of dates more easy?

    There is no built-in date picker available for forms created in Acrobat. There are some third-party solutions involving JavaScript (either a large collection of fields or a custom dialog) though. Also, text fields with date formatting will use a wheel type date picker on Android/iOS devices with Adobe Reader.

  • How can I get right data in a cell of JTable when table  enter editing

    how can I get right data in a cell of JTable when table enter editing

    how can I get right data in a cell of JTable when table enter editing

  • How can i get the data from database & add them as a link

    Hi,
    how can i get a data from a database(DB2) and that data will be having a file so i should make them as a link.i tried it in jsp .
    <%
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
    Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");     
    response.setContentType("text/html");
    Connection conn = null;
    conn = DriverManager.getConnection("jdbc:db2:spintran");
    Statement stmt = conn.createStatement();
    stmt.executeQuery("set current schema tut");
    ResultSet rs = stmt.executeQuery("select * from tutorial");     
    %>
    Type Of the Category : &nbsp&nbsp&nbsp
    <%
         while (rs.next())
         String desc = rs.getString(1);     
         out.println(desc);
    %>
         <A HREF = "<%=desc%>"><%=desc%> </A>
         <%
         %>
    but it is not working.how can i link.
    thank you.

    what is desc? is it the file name ? whats the data type of desc in db? INFILE?
    if desc is just the name of the file, then make sure that such a file exists in the proper folder.only then the link works..
    that is, if desc is 'a.jpg' then a.jpg should be existing in the same folder as your html is.

  • I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    Try cleaning the lens and see if that will restore functionality to the DVD drive.  Use a DVD lens cleaning disk, if you have a can of compressed air, shoot some into the slot or wrap a fine microfiber cloth (eyeglasses cleaning cloth)  around a business card and insert it gently inside the slot.
    If no success, make an appointment at an Apple store genius bar and get a free diagnosis from them.
    Ciao.

  • How can I get the data back from my game

    How can I get the data back from minecraft if I deleted the app and bought with a different Apple ID

    No, they are tied to the ID that purchased them, and cannot be transferred to anyone else.

  • Lost all of my data on iphone and have no cloud back up how can i get my data back

    lost all of my data on iphone and have no cloud back up how can i get my data back

    iOS devices do backup automatically to iCloud providing:
    iCloud Backup is turned on
    It has a Wi-Fi connection
    It is connected to a power source
    The screen is off
    5GB is plenty of storage for me to backup to iCloud automatically.
    I have a 64GB iPhone & a 128GB iPad both backing up to the same iCloud account and I still have nearly 2GB free.
    This is mainly because media is not backed up and Photo Stream & iTunes purchases do not count against your iCloud storage.
    Here’s what iCloud backs up:
    Purchase history for music, movies, TV shows, apps, and booksYour iCloud backup includes information about the content you have purchased, but not the purchased content itself. When you restore from an iCloud backup, your purchased content is automatically downloaded from the iTunes Store, App Store, or iBooks Store. Some types of content aren’t downloaded automatically in all countries, and previous purchases may be unavailable if they have been refunded or are no longer available in the store. For more information, see the Apple Support article iTunes in the Cloud availability by country. Some types of content aren’t available in all countries. For more information, see the Apple Support article Which types of items can I buy in my country?.
    Photos and videos in your Camera Roll
    Device settings
    App data
    Home screen and app organization
    iMessage, text (SMS), and MMS messages
    Ringtones
    Visual Voicemail

  • How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    Restore from the iCloud backup - assuming that you were backing up to iCloud in the first place. If you weren't using iCloud for backup - then you are out of luck.
    If you were backing up to iCloud - you have to erase all contents on the iPad in Settings>General>Reset>Erase all content and settings - before you can restore from the iCloud backup.
    Read this article before you do anything else
    http://gigaom.com/apple/ios-101-set-up-and-restore-from-icloud-backup/

  • HT1414 i backed up tha data on my iphone before i unlocked and restored as "new." how can i get the data back onto my iphone?i backed up tha data on my iphone before i unlocked and restored as "new." how can i get the data back onto my iphone?

    Hi,
    I wanted to unlock my at&t iphone 3gs that i had for 3  years.  i was told to back up the data on my phone and then restore it as new.  now i don't have any data i had before it was restored. how can i get that data back onto my iphone 3gs?  can i put that data on my ipad?

    Is it an iTunes backup or an iCloud backup? If iTunes, connect the iPhone, right click on the name of the iPhone under the DEVICES section in iTunes. Click on Restore from Backup.
    If iCloud, on the iPhone go to Settings > General > Reset > Erase All Content and Settings. When the device powers back on, you will see the original setup screens you saw when your iPhone was fresh out of the box. One of these screen asks you if you want to restore. Choose Restore from iCloud backup.

  • HT1766 i lost my i phone 5 how can i get my data back

    i lost my i phone 5 how can i get my data back

    Have you backed up your iPhone 5 with iTunes?
    If so, you may use an iTunes backup extractor to recover your data from the backup file.
    http://easy-iphone-recovery.blogspot.com/iphone-recovery-resource.html
    You can use 'Recover from iTunes backup' mode to have a try.

  • Hi, may i know how can i get all data back after update ios 6

    Hi,
    May i know how can i get all data back after update ios 6 and all my data lost ?

    You can restore the phone and when prompted to restore choose from icloud account. BUT MAKE SURE there is 1.) an icloud backup for your phone. 2.) you are using the same apple id.
    apl

Maybe you are looking for