How can i get the current date in a string in Android?
I know that it's gettable using
Calendar c = Calendar.getInstance();
SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
String formatDate = df.format(c.getTime());
But i get it as 25-Mar-2014, and what i want is 25-3-2014. Thanks.
Try this..
Change dd-MMM-yyyy to dd-MM-yyyy
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
String formatDate = df.format(c.getTime());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With