
br.com.tecsinapse.dataio.converter.LocalDateTimeTableCellConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tecsinapse-data-io Show documentation
Show all versions of tecsinapse-data-io Show documentation
A simple way to work with CSV, XLSX? and TXT files
The newest version!
/*
* Tecsinapse Data Input and Output
*
* License: GNU Lesser General Public License (LGPL), version 3 or later
* See the LICENSE file in the root directory or .
*/
package br.com.tecsinapse.dataio.converter;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import com.google.common.base.Strings;
public class LocalDateTimeTableCellConverter implements FromDateConverter {
public static final LocalDateTimeTableCellConverter LOCAL_DATE_TIME_CONVERTER = new LocalDateTimeTableCellConverter();
@Override
public LocalDateTime apply(Date input) {
return LocalDateTime.ofInstant(input.toInstant(), ZoneId.systemDefault());
}
@Override
public LocalDateTime apply(String input) {
return Strings.isNullOrEmpty(input) ? null : LocalDateTime.parse(input);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy