Java SQL LocalDate toLocalDate(java.util.Date d)

Here you can find the source of toLocalDate(java.util.Date d)

Description

to Local Date

License

Apache License

Declaration

public static LocalDate toLocalDate(java.util.Date d) 

Method Source Code

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

import org.joda.time.DateTimeZone;
import org.joda.time.LocalDate;

import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

public class Main {
    public static final DateTimeFormatter localDateFormatter = DateTimeFormat.forPattern("YYYYMMDD");

    public static LocalDate toLocalDate(java.sql.Date d) {
        // TODO - confirm this conversion always works, esp. across timezones
        LocalDate ld = (d == null ? null : LocalDate.fromDateFields(d));
        return ld;
    }//from w  ww . jav  a 2s.  com

    public static LocalDate toLocalDate(java.util.Date d) {
        // TODO - confirm this conversion always works, esp. across timezones
        LocalDate ld = (d == null ? null : LocalDate.fromDateFields(d));
        return ld;
    }

    public static LocalDate toLocalDate(String s) {
        // TODO - confirm this conversion always works, esp. across timezones
        LocalDate ld = (s == null ? null
                : localDateFormatter.withZone(DateTimeZone.UTC).parseDateTime(s).toLocalDate());
        return ld;
    }
}

Related

  1. toJDBC(LocalDate fecha)
  2. toLocalDate(Date date)
  3. toLocalDate(Date date)
  4. toLocalDate(final Date d)
  5. toLocalDate(java.sql.Date date)
  6. toSqlDate(Date d)
  7. toSQLDate(DateMidnight dm)
  8. toSqlDate(LocalDate ld)
  9. toSqlDateNoInicio(LocalDate data)