android-dateutils

I can't import java.util.date in activity

半世苍凉 提交于 2020-01-16 04:17:19
问题 In my project I need to to use current date and time. For this I'm importing java.util.Date. This import is working fine few hours ago. But I have an error in R file ( r cannot resolve ) and this error is because of some xml mistake. When I resolved that issue and sync project again that error is gone. But after that I cannot able to import (java.util.Date , java.util.Calendar) in any of my project. I tried to import this in my newly created project. But still not found java.util.Date. Even

DateUtils.formatDateRange() issues when formatting date range

风流意气都作罢 提交于 2020-01-07 01:49:56
问题 In my app, I receive dates from a webservice in the form yyyy-MM-dd (e.g. 2016-03-05 ) and I need to format them as [abbreviated month] [date], e.g. Mar 5 . Additionally, I have a start and end date and want to show them as a date range, unless both dates are the same. Currently I'm using DateUtils.formatDateRange(), which should take care of my requirements and provide proper localization, but I'm running into two problems: When my end date is the day after my start date, formatDateRange()

Formatting date & time according to user's locale & preferences with seconds

徘徊边缘 提交于 2019-12-10 16:45:23
问题 I am attempting to get a formatted date (year, month, date) and time (hour, minute, second) string according to the user's settings. This post in the Android Developers Google Group describes the precise problem I am having, but no one helped that person solve it. I will summarize it: Android has these classes that attempt to do the above, but none use both the user preferences and display the seconds. java.text.DateFormat Doesn't use preferences set in Settings app android.text.format

how to convert a date dd / mm / yyyy to yyyy-MM-dd HH:mm:ss Android [duplicate]

只谈情不闲聊 提交于 2019-12-09 09:46:32
问题 This question already has answers here : What's the best way to parse an XML dateTime in Java? (9 answers) Closed 3 years ago . How can I convert a date in dd / mm / yyyy to a format that supports sqlite yyyy-MM-dd'T'HH: mm: ss for example: public static String convertStringToData(String stringData) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/aaaa");//yyyy-MM-dd'T'HH:mm:ss SimpleDateFormat output = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date data = sdf