DateTime withTimeAtEndOfDay
See original GitHub issueHi,
Would you accept a PR adding DateTime#withTimeAtEndOfDay
(and probably LocalDate#toDateTimeAtEndOfDay
to support it)?
I’m often in a situation where I want to find some records by receiving a date (a DateTime
instance) searching in my database between the start of day of this date (using date.withTimeAtStartOfDay()
) and the end of day of this date (currently using date.withTime(23, 59, 59, 999)
).
Having the opposite of withTimeAtStartOfDay
would help readability of this kind of code.
Regards, Matt
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
DateTime (Joda-Time 2.12.1 API) - Joda.org
withTimeAtStartOfDay. public DateTime withTimeAtStartOfDay(). Returns a copy of this datetime with the time set to the start of the day.
Read more >java.time equivalent of Joda-Time `withTimeAtStartOfDay ...
In the Joda-Time library, the DateTime class offers a method withTimeAtStartOfDay to get the first moment of the day.
Read more >org.joda.time.DateTime.withTimeAtStartOfDay java ... - Tabnine
Best Java code snippets using org.joda.time.DateTime.withTimeAtStartOfDay (Showing top 20 results out of 459) · Number of days between two dates in Joda-Time.
Read more >Example usage for org.joda.time DateTime ... - Java2s.com
List of usage examples for org.joda.time DateTime withTimeAtStartOfDay ... Returns a copy of this datetime with the time set to the start of...
Read more >org.joda.time.DateTime#withTimeAtStartOfDay
This page shows Java code examples of org.joda.time.DateTime#withTimeAtStartOfDay.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was looking for this as well, but I found another solution. I end up using .millisOfDay().withMaximumValue(). See example
Use this
DateTime.now().withTimeAtStartOfDay().minusSeconds(1).toDate()