Saturday, January 19, 2013

Get Current date with timestamp:


get  current date with timestamp  as  a string  ---

string date = (DateFormat.format("dd-MM-yyyy hh:mm:ss", new java.util.Date()).toString());

Get only time –
String mytime = java.text.DateFormat.getTimeInstance().format(Calendar.getInstance().getTime());

Get only date -
String mydate =java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime());


No comments:

Post a Comment