Skip to content
Advertisement

Tag: datetime-format

What is pattern for 2000-11-10T00:00:00+02:00

I need to convert string in 2000-11-10T00:00:00+02:00 format to LocalDateTime object. But when I parse this string to LocalDateTime, it gives error. Which pattern should I use to parse the string to LocalDateTime object? Answer Your string contains time zone and LocalDateTime does not contgain this information. You need to use OffsetDateTime class or ZonedDateTime class. The information on the

Create a DateTimeFormater with an Optional Section at Beginning

I have timecodes with this structure hh:mm:ss.SSS for which i have a own Class, implementing the Temporal Interface. It has the custom Field TimecodeHour Field allowing values greater than 23 for hour. I want to parse with DateTimeFormatter. The hour value is optional (can be omitted, and hours can be greater than 24); as RegEx (d*dd:)?dd:dd.ddd For the purpose of

How to get list of months between two dates in Java

I am trying to get a list of months (actually the first days of those months) between two dates in Java but I am not getting the expected results. The start date is “3/17/2020”, the end date “3/17/2021” and the expected result is as follows: Here below is the code I am using: With the above code I am getting

How parse 2013-03-13T20:59:31+0000 date string to Date

How to parse this format date string 2013-03-13T20:59:31+0000 to Date object? I’m trying on this way but it doesn’t work. I get this exception from the first line: java.lang.IllegalArgumentException: Illegal pattern character ‘T’ Answer DateFormat df = new SimpleDateFormat(“yyyy-MM-dd’T’hh:mm:ssZ”); Year is lower case y. Any characters that are in the input which are not related to the date (like the

get timezone in “+0100” (for example) format

I got lost between the documentation and the numerous time-related questions found by google. What I want is very simple: a string that represents the running timezone in the “[+/-] [number] [number] [number] [number]” format (for instance “+0100”). My current code is: which returns “GMT” in my location, which I assume is the short version (3 letters) of the timezones.

Advertisement