Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: DateUtils.formatDateTime change date and time sequence

Tags:

date

android

I'm converting date into date and time string. I use following code:

String result = DateUtils.formatDateTime(
            getApplicationContext(), 
            millis,
            (DateUtils.FORMAT_SHOW_DATE | 
             DateUtils.FORMAT_SHOW_TIME | 
             DateUtils.FORMAT_NUMERIC_DATE));

In result I get 14:17, 20.01.2013. But I want to get 20.01.2013, 14:17. I didn't found any flag to set sequence of date and time.

Is there easy way to convert date into localized string with format "[date], [time]"?

Thanks.

like image 973
sasha_trn Avatar asked Dec 10 '25 20:12

sasha_trn


1 Answers

I don't beleive DateUtils can do this. Consider using SimpleDateFormat with the user's Locale or your specific format "dd.MM.yyyy, HH:mm".

like image 140
Sam Avatar answered Dec 12 '25 14:12

Sam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!