Questions tagged [localdate]

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.

656 questions
-1
votes
1 answer

How to format date in java 8?

I have to write a function to accept a list of date which are in different formated strings and return a list of Stringdates same format. I have tried the following code but some dates cannot parse. please help me to get the correct output. public…
dasun_001
  • 139
  • 2
  • 3
  • 12
-1
votes
1 answer

Formatting a Local Date output

So, I have a class "Person" that contains a constructor with 4 parameters - 3 Strings and 1 Local Date and an overridden toString method that writes the output onto the console (it also converts the LocalDate variable to a String). Here is the code…
cuphead
  • 7
  • 3
-1
votes
3 answers

How to find every week dates between startDate and endDate passing string like " Wed, Thu" which is dynamically passed

when i passing startDate and endDate with day of week like as string "Mon ,Tue, Wed, Thu, Fri, Sat, Sun" then i want date of every weekly based on passing day of week between startDate and endDate. Days is may be fully week or custom day from…
-1
votes
2 answers

Exception thrown when parsing data

Sorry if this is a rookie question, but I have the following problem: every time I try to parse a string into a LocalDate type, with a specific format (ddMMyyy) I get the following message: Exception in thread "main"…
TardisBug
  • 3
  • 2
-1
votes
2 answers

Cant figure out why I get a null pointer exception while setting month using java.localdate

I am creating a program that uses 2 classes, one that creates an author with a name and birthday that is constructed using java.localdate and a second that creates a book that refers to the author class. Using a demo class I am attempting to set…
RacerX142
  • 7
  • 2
-1
votes
2 answers

Java Date Utils exercise

I'm doing a training course at the moment and it's causing me a lot of problems. The code is below. The problem I'm having is that the training course requires a specific solution based on the java.time.LocalDate import. I've tried multiple…
Tufty
  • 475
  • 8
  • 24
-1
votes
1 answer

How to localize numbers with DateTimeFormatter?

The java.time.format.DateTimeFormatter class does not work correctly for locales that use different symbols to represent numbers. Languages such as Persian (also called Farsi) use different symbols and Unicode characters to represent…
Mahozad
  • 18,032
  • 13
  • 118
  • 133
-1
votes
2 answers

Java date-manipulation

I'm trying to get a date with a Month number, week of month number and a day of week number I thought this will be easy and did this: LocalDate nextbookingDate = LocalDate.now().plusYears(1); nextBookingDate =…
Leon
  • 5
  • 5
-1
votes
3 answers

Last date of next month in Java

How to get the last date of next month in Java? Background: I have project, user only interested in the orders should be completed by the end of next month. So I need to get the last date of next month and compare to the order end date, if the…
Richard
  • 2,080
  • 18
  • 17
-1
votes
2 answers

Adding a new Booking to a list of Bookings, each Booking has two LocalDates (checkin, checkout)

So I'm working on a personal project, trying to learn Java 8 and Spring Boot. I'm developing a REST API where you can view and book accommodations. These are my model classes, here's the Accommodation class: @Data @Document(collection =…
Andrea Damiani
  • 611
  • 1
  • 6
  • 20
-1
votes
1 answer

Way to validate date from cmd

I need to validate somehow two dates, but I do not know which way is the best. In mainclass I created objects which I are passed by constructor to NBPParserEngine. package pl.parser.nbp; import pl.parser.nbp.calculations.RateCalculations; import…
pipilam
  • 587
  • 3
  • 9
  • 22
-1
votes
2 answers

How to give Error message when user input wrong format of date in Java8

I want to give an error message if the user inputs using the wrong format. The correct format is "yyyy-MM-dd HH:mm:ss". How can I put that as a condition? for example if (yyyy <0 ) { sout("please input correct year")} this is the code i use for…
Agung Banar
  • 13
  • 1
  • 5
-1
votes
2 answers

Java : to get current india time

I am not able to get current india time. I want to get current time for india, i updated my system clock after 5 minute then current time, so my system clock is running 5 minute earlier than actual india time but i want to get standard time for…
Bharti Ladumor
  • 1,624
  • 1
  • 10
  • 17
-1
votes
1 answer

DateRange iterating wrong (code taken from SO)

A few months ago I found this thread about iterating over days in java Java 8 LocalDate - How do I get all dates between two dates? And started using class DateRange: public class DateRange implements Iterable { private final…
Clomez
  • 1,410
  • 3
  • 21
  • 41
-1
votes
3 answers

Java - create group of dates by Month from 2 dates

Using Java 8 Goal From two dates (for example: firstDay 2018-09-01 and lastDay 2018-11-10), I would like to create two arrays of firstDay and lastDay created by month. For example: List firstDays =…