Java ZonedDateTime Calculate isoDateTime(ZonedDateTime zonedDateTime)

Here you can find the source of isoDateTime(ZonedDateTime zonedDateTime)

Description

iso Date Time

License

Apache License

Declaration

public static String isoDateTime(ZonedDateTime zonedDateTime) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
    public static String isoDateTime(ZonedDateTime zonedDateTime) {
        return zonedDateTime.format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
    }/*from  w w  w. j  a  v  a2s .  co  m*/

    public static ZonedDateTime isoDateTime(int year, int month, int dayOfMonth, int hourOfDay, int minute,
            int second, int millisec) {
        //      Calendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        //      calendar.set(year, month-1, dayOfMonth, hourOfDay, minute, second);
        //      calendar.add(Calendar.MILLISECOND, millisec);
        //      return isoDateTime(calendar.getTime());
        return ZonedDateTime.of(year, month, dayOfMonth, hourOfDay, minute, second, millisec * 1000000,
                ZoneOffset.UTC);
    }

    public static ZonedDateTime isoDateTime(String s) throws ParseException {
        return ZonedDateTime.parse(s);
    }
}

Related

  1. getTime(ZonedDateTime zonedTime)
  2. getTimePath(Path dir, String ext, ZonedDateTime dateTime)
  3. getZonedDateTimeForComparison(TimeZone zone)
  4. holidaysInRange(ZonedDateTime startDate, ZonedDateTime endDate, List holidays)
  5. isBetweenTimesInclusive(ZonedDateTime dateTime, ZonedDateTime startDateTime, ZonedDateTime endDateTime)
  6. mapToZonedDateTime(final Date date)
  7. max(ZonedDateTime a, ZonedDateTime b)
  8. oneDayLater(ZonedDateTime baseDate)
  9. parseZdtToDate(ZonedDateTime zdt)