Monthly Archives: November 2012

[ANDROID]HOW TO GET SYSTEM DATE/TIME FORMAT BY LOCALE ?

private java.text.DateFormat mDateFormat;
private java.text.DateFormat mTimeFormat;
//// init values

// onCreate() for e.g

mDateFormat = android.text.format.DateFormat.getDateFormat(this);
mTimeFormat = android.text.format.DateFormat.getDateFormat(this);

// use
dateTimeString = mDateFormat.format(objectX.getTime()) + ” ” + mTimeFormat.format(objectY.getTime());

Advertisements