All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.afterturn.easypoi.util.ExcelDateUtil Maven / Gradle / Ivy

The newest version!
package cn.afterturn.easypoi.util;

import org.apache.poi.ss.usermodel.Cell;

import java.util.Objects;

/**
 * Excel日期
 *
 * @author liuxu
 * @date 2024/01/22
 */
public class ExcelDateUtil {

    /**
     * 是否为本地化日期
* 对照表: * https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.numberingformat?view=openxml-3.0.1 * * @param cell 单元格对象 * @return boolean */ public static boolean isLocalDateFormat(Cell cell) { if (Objects.isNull(cell) || Objects.isNull(cell.getCellStyle())) { return false; } int format = cell.getCellStyle().getDataFormat(); switch (format) { case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: return true; } return false; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy