Java LocalDateTime to luisDate(LocalDateTime date)

Here you can find the source of luisDate(LocalDateTime date)

Description

luis Date

License

Open Source License

Declaration

public static String luisDate(LocalDateTime date) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.time.LocalDateTime;

public class Main {
    private static final String dateDelimiter = "-";

    public static String luisDate(Integer year, Integer month, Integer day) {
        if (year == -1) {
            if (month == -1) {
                if (day == -1) {
                    return String.join(dateDelimiter, "XXXX", "XX", "XX");
                }/*from  w  ww  .  ja v a 2s  . c om*/

                return String.join(dateDelimiter, "XXXX", "XX", String.format("%02d", day));
            }

            return String.join(dateDelimiter, "XXXX", String.format("%02d", month), String.format("%02d", day));
        }

        return String.join(dateDelimiter, String.format("%04d", year), String.format("%02d", month),
                String.format("%02d", day));
    }

    public static String luisDate(LocalDateTime date) {
        return luisDate(date.getYear(), date.getMonthValue(), date.getDayOfMonth());
    }
}

Related

  1. localDateTimeToDate(LocalDateTime ldt)
  2. localDateTimeToEpochMillis(TemporalAccessor temporal)
  3. localDateTimeToString(LocalDateTime value)
  4. localDateTimeToTimestamp(LocalDateTime ldt)
  5. longTOLocalDateTime(long minDate)
  6. millisToLocalDateTime(Long inMillis)
  7. toDate(LocalDateTime dateTime)
  8. toDate(LocalDateTime ldt)
  9. toDateHeader(LocalDateTime dt)