java-time Questions
3
Solved
I get this error with this code:
SimpleDateFormat sdf = new SimpleDateFormat("EEEE dd MMMM HH:mm yyyy",myDateFormatSymbols);
sdf.parse("понеділок 12 квітень 07:00 2021");
Whis ...
Tragopan asked 9/4, 2021 at 22:14
2
Solved
I have tried using -
int startSeconds = restaurant.openingTime.toSecondOfDay();
int endSeconds = restaurant.closingTime.toSecondOfDay();
LocalTime timeBetweenOpenClose = LocalTime.ofSecondOfDay(Thr...
1
Solved
I'm parsing logs from different sources, I'm extracting datetime string from log. Now I want to convert it into java ZonedDateTime.
Problem here is, I don't know exact datetime format, I just know ...
4
Solved
When creating a new LocalDateTime using LocalDateTime.now() on my Mac and Windows machine i get a nano precision of 6 on my Mac and a nano precision of 3 on my Windows machine. Both are running jdk...
4
I am trying to use java.time.LocalDate in my android app, however if I try to import it, then any class from java.time gives a cannot resolve symbol error in Android studio 1.1
The only reason I c...
Mencius asked 26/2, 2015 at 14:37
4
Solved
I created two ZonedDateTime objects and I think they are should be equal:
public static void main(String[] args) {
ZoneId zid = ZoneId.of("America/New_York");
ZoneOffset offset = ZoneOffset.from...
3
Solved
I have the following joda date parser:
ISODateTimeFormat.dateTimeParser().withOffsetParsed().
I'd like to refactor this to java.time api. But what is the exact equivalent to the parser above, esp...
3
Solved
I am trying to parse: 2014-05-02-10.45.05.993280-5:00 where the -5:00 is the offset from UTC. Using a java.time DateTimeFormatter in Java 8.
For the first bit I have the following: yyyy-MM-dd-HH.m...
5
Solved
I am trying to learn the new Date & Time API. My code is working except for the last line:
LocalDate current=LocalDate.now();
System.out.println(current);
LocalDate personaldate=LocalDate.of(...
2
Solved
Getting date from https://api.spacexdata.com/v3/launches
This date have format: 2006-03-25T10:30:00+12:00.
I want convert it to "dd, mm, yyyy", but always getting error:
"java.time.f...
Judoka asked 26/1, 2021 at 20:29
3
Solved
I am trying to parse some dates, but the DateTimeParser seems to disagree with me on what is valid
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import java.util.Locale
...
0
I have a best practices question with regards to mapping Instant to PostgreSQL TIMESTAMP.
We've updated our app to Java 15 and the new enhancement of the system clock to nanosecond precision ...
Odawa asked 6/1, 2021 at 11:23
1
Solved
I want to parse custom multiple Date formats in Java. Here is my code
Scenario 1:
Order of patterns:
yyMMdd'h'HH
yyMMdd
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.appendOption...
3
Solved
In the java.time framework of Java 8 and later, the Duration class says:
This class models a quantity or amount of time in terms of seconds and nanoseconds. It can be accessed using other durati...
3
Solved
10
Convert LocalDateTime to LocalDateTime in UTC.
LocalDateTime convertToUtc(LocalDateTime date) {
//do conversion
}
I searched over net. But did not get a solution
7
Solved
I have an entity with java.time.Instant for created data field:
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class Item {
private String id;
private String ur...
Bolitho asked 13/8, 2017 at 17:4
5
Solved
I have problems with Date class in Java. Date class returns local machine date but i need UTC-0.
I have googled and found great solution for JavaScript but for Java nothing useful.
How to get UTC...
2
Solved
Let's say that we have an appointment in Milan Italy happening on 01/23/2021 21:00 "Europe/Rome". This appointment is saved to the database in UTC in a column of a type akin to the SQL-st...
Mixtec asked 26/10, 2020 at 21:57
9
Solved
Java 8 has a completely new API for date and time. One of the most useful classes in this API is LocalDateTime, for holding a timezone-independent date-with-time value.
There are probably million...
2
Solved
Time zone ids of Joda Time can simply be displayed with the following segment of code.
Set<String> zoneIds = DateTimeZone.getAvailableIDs();
for(String zoneId:zoneIds) {
System.out.println...
2
I am trying to get the local time in spark-scala but it is returning UTC.
I am using java.time.LocalDateTime to get the current timestamp. But its returning the UTC standard.
java.sql.Timestamp.v...
Truda asked 28/9, 2019 at 5:47
3
Solved
I want to get the difference in seconds to find whether the system timezone is ahead or behind the remote timezone. Here the remote timezone value is "GMT" which i fetch from Database. It...
2
Solved
I am trying to parse a date string using the following pattern: yyMMdd and the STRICT resolver as follows:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat).withResolverStyle(R...
3
Solved
I want to parse a date string like 2011-11-30 like this:
LocalDateTime.parse("2011-11-30", DateTimeFormatter.ISO_LOCAL_DATE)
But I get the following exception:
java.time.format.DateTimeParseExc...
Derwin asked 9/1, 2016 at 23:2
© 2022 - 2024 — McMap. All rights reserved.