LocalDate is part of the java.time package and represents a year-month-day in the ISO calendar and is useful for representing a date without a time, such as 2000-01-01 (January 1st 2000). It can be used for storing a birth date for example.
Questions tagged [localdate]
656 questions
-2
votes
3 answers
Assign ("Months-days-hours") to a LocalDate variable
After a lot of tries I didn't found a way to assign a date taken from sql to a LocalDate variable in a pattern of ("MM-dd-hh"). I have defined a timestamp field(it goes from years to seconds) which I need to set a prenotation hour, day and month.…

RolloBallo
- 13
- 5
-2
votes
1 answer
localdate parsing can't parse hours and minutes
I need to get the date from a String, the format is the following: uuuu-MM-dd HH:mm
The input has that format and I want the same format for my dates (year-month-day hour:minutes). When I did this:
LocalDate aux =…

Aikas
- 67
- 2
- 7
-2
votes
1 answer
Scala generic format convert determain
Please see this function that convert String into LocalDate:
def getLocalDate(date: String): LocalDate = {
LocalDate.parse(date, format.DateTimeFormatter.ofPattern("dd MMM, yyyy"))
}
Usage:
val date = "01 Jan, 2010"
val localDate =…

david hol
- 1,272
- 7
- 22
- 44
-3
votes
0 answers
LocalDate cannot be resolved to a type in java Eclipse
import java.time.LocalDate;
public class LocalDateExample1 {
public static void main(String[] args) {
LocalDate date = LocalDate.now();
LocalDate yesterday = date.minusDays(1);
LocalDate tomorrow =…

MOHANRAM
- 1
- 2
-3
votes
1 answer
How to create a for loop with an if statement inside?
I am trying to get my code to print only names of people who were born on or after 01-01-1990. I don't know how to write the if statement condition correctly in Java. Here is my code:
Person a = new Person("John", LocalDate.parse("1969-03-15"),…

Magz_k
- 9
-3
votes
1 answer
Java LocalDate format from reading from JSON and saving to Database
In as Spring Boot app, I am reading LocalDate from a JSON in dd/MM/yyyy format e.g. 15/03/2009 and while reading, I created them to a request. The format in the request is dd/MM/yyyy.
*ProductRequest:
@JsonFormat(shape = JsonFormat.Shape.STRING,…
user19728533
-3
votes
1 answer
Error from JFormattedTextField to LocalDate - java.time.format.DateTimeParseException
I have a JFormattedTextField in which the format is dd/MM/yyyy
I want to extract the day, month and year of a date, in dd/MM/yyyy format, time date "ES" (Spain).
I run the JFrame, and if I press button, having the JFormattedTextField empty, why do I…

SrCantabri
- 37
- 5
-3
votes
1 answer
Get day of month from LocalDate with leading zero
I get date in a format like LocalDate dateOfBirthday = LocalDate.of(2000, 1, 1);.
I need to get the day of the month from that date. I using dateOfBirthday.getDayOfMonth() and it works and return 1, but I need to get 01.
How I can do it?

robert0801
- 140
- 1
- 12
-3
votes
4 answers
How would I properly filter dates that are in between a start date and end date, using the Java Streams API?
So I've been using the Java Streams API, and I'm trying to filter dates in my DB, in which the start date of something is before the current date, and the end date is after the current date. I've tried multiple things, but nothing I've tried so far…

James
- 300
- 1
- 4
- 11
-3
votes
2 answers
How would I get the amount of weekdays in a month with LocalDate - Java
How would I go about getting the number of weekdays (Monday though Friday) in a month with LocalDate? I've never used java.time before so I don't know all of its workings. I've been looking on this site to no avail along with searching for an…

Kyu Vulpes
- 79
- 11
-3
votes
1 answer
Java LocalDate parser does not take hours, minutes, seconds into account
I want to parse DateTime from a string.
Here is my code:
String dateStr = "2016-08-18T14:44:56.225Z"
final String Pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
final DateTimeFormatter dtf = DateTimeFormat.forPattern(Pattern);
LocalDate dt =…

trung truong
- 1
- 1
- 2
- 4
-4
votes
1 answer
How to takes a list of objects of something type and return list of objects of different type
I have a problem. I want to write a method which as an argument takes a list of objects of type A, some mapper which change this and returns a list of objects of type B
For example:
List date = mapTo (Arrays.asList ("2014-01-01",…

borkovicz
- 11
- 2
-4
votes
1 answer
Java User input time
Im working on a To-Do list program.
I want to make it for the user possible to input a date, time and regarding. I already have the date. What Im missing is the time.
DateTimeFormatter formateTime = DateTimeFormatter.ofPattern("HH:mm");
LocalDate…

PizzaE4ter
- 3
- 2
-4
votes
1 answer
How to return the number of weekdays from two dates in java
I have two dates example: start date = Friday 03/19/2020 and end date = Tuesday 03/21/2020. If I return the number of calendar days, it will be 4. How can I write the method to only return the business days from the above start and end…
-4
votes
1 answer
LocalDate returns random date
I am using below code to fetch todays date but its giving me 20190909 for the first run and 20190910 for the second run.
I am running this at ny time 8:15pm onv 10sep2019.
LocalDate date =…

Abhishek
- 519
- 1
- 6
- 24