com.mycompany.exceldatetimetest.test.java Source code

Java tutorial

Introduction

Here is the source code for com.mycompany.exceldatetimetest.test.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.exceldatetimetest;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

/**
 *
 * @author matve_000
 */
public class test {
    public static void main(String[] args) throws Exception {
        //get date-lime from excel
        File file = new File("Book1.xlsx");
        XSSFWorkbook xssfwb = new XSSFWorkbook(file);
        Sheet sh = xssfwb.getSheet("?1");
        Date date = sh.getRow(1).getCell(0).getDateCellValue();
        System.err.println(date);

        //save to db

    }
}