Click here to Skip to main content
15,916,398 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am assigning date to edittext in dd-MM-yyyy format using datepicker dialog,now before sending my date to database i want to change my date format as yyyy-MM-dd.
i want to send my date as string format.For this conversion i had tried the following code..

C#
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
        String from=fromDateEtxt.getText().toString();
        Date d=new Date();
        try
        {
             d = inputFormat.parse(from);
        }
          catch (ParseException e1)
        {
            e1.printStackTrace();
        }
        String f=inputFormat.format(d);

Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900