![]() ![]() If you are working for an Android project and your Android API level is still not compliant with Java-8, check Java 8+ APIs available through desugaring and How to use ThreeTenABP in Android Project.For any reason, if you have to stick to Java 6 or Java 7, you can use ThreeTen-Backport which backports most of the java.time functionality to Java 6 & 7.It is recommended to stop using them completely and switch to the modern date-time API. ![]() The date-time API of java.util and their formatting API, SimpleDateFormat are outdated and error-prone. I am trying to understand, what special advantages I might achieve by using joda time, because the same compassion can be done using SimpleDateFormatter. Please recommend, what is the better-way to deal with this problem. So at 5:00pm PST, when variable expiryDate contains contains "", variable now becomes "" When looked closely, LocalDate expiryDate was using UTC chronology. LocalDate expiryDate = omDateFields(expiresOn) // expiresOn is īoolean notExpired = expiryDate.isEqual(now) || expiryDate.isAfter(now) Date exists in PST and when converted to LocalDate following conversion comes false at 5:00 pm PST, when it should be true - LocalDate now = omDateFields(new Date()) // Current date in PST Even some post are recommending that like this.īut recently found some problem with timezones. Presently JODA time library has been used to achieve this simple comparison. There is requirement to see if some date (ex: expiry date) is greater than or equal to today. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |