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.

524 questions
-2
votes
1 answer

Subtract two dates in dd-MMM-yy HH:mm format

The date looks like: 25/apr/18 10:24 AM Here's the code I'm trying to use DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yy HH:mm"); LocalDate open = LocalDate.parse(openTime.toString(), dtf); LocalDate now = LocalDate.now(); now =…
A_Elric
  • 2,968
  • 11
  • 46
  • 80
-2
votes
1 answer

LocalDate.parse (Not Working)

Please! I would like to understand why this simple LocalDate parsing isn't working! My DateFormatter works (in both ways), but when I'm trying to parse into a new LocalDate variable (using the same Formatter), it doesn't work and I get the following…
Erick Cabral
  • 109
  • 6
-2
votes
1 answer

How to correctly parse to LocalDate from String in Java?

I faced a strange issue. I can't parse String value to LocalDate. The problem is that in runtime I paused at breakpoint and execute parsing in evaluate expression tool and it works. But then I continue application and I get an exception with next…
-2
votes
2 answers

How to know the number of days between 2 dates in java?

I'm trying to calculate the difference between two dates in java. For example, I have: LocalDate TodayDate = LocalDate.now(); //That returns me ==> year/month/day LocalDate ExpireDay = LocalDate.of("2018-01-12"); I want to know how many days are…
-2
votes
1 answer

Convert LocalTime for given zone to unix epoch seconds without the date component in java

We received time as hour =11, minutes=29,seconds=54,milliseonds=999 along with timezone information. How to convert this time to unix epoch milliseconds with no date part. I have tried this code : ZoneId zoneId = ZoneId.of("America/New_York"); …
RGoyal
  • 103
  • 1
  • 15
-2
votes
2 answers

Save java.time.LocalDate in Date column of DB2 database

How to persist an item of java.time.LocalDate in a column of type Date within a DB2 database ?
Ghassen
  • 421
  • 8
  • 21
-2
votes
1 answer

How to convert String to LocalDate format without using any formatter and string methods

String value="2017/3/4"; I want my string value in LocalDate format like "2017-03-04" How to convert this value to my localdate without using any formatter and string methods like split(),indexof().
Tamil.S
  • 111
  • 9
-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
  • 4
-2
votes
2 answers

java.time.DateTimeException: Invalid value for Year (valid values -999999999 - 999999999)

I am getting this exception when I am trying to convert epochTime to LocalDate where: 1) Date : 2017-05-05 10:08:52.0 2) corresponding epoch :1493959132000 LocalDate lastUpdatedDate = LocalDate.ofEpochDay(1493959132000); Exception…
-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,126
  • 6
  • 19
  • 30
-3
votes
1 answer

How to find the day when year, month and date is given?

I need a solution to return day (Monday,Tuesday...), when i have inputs like YEAR, MONTH, DATE. public static String findDay(int month, int day, int year) { // code here }
Vaibhav Atray
  • 35
  • 1
  • 8
-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
  • 150
  • 1
  • 2
  • 10
-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
  • 59
  • 9
-3
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
  • 37
  • 6
-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
  • 2
  • 3
1 2 3
34
35