Best timestamp format for CSV/Excel?

前端 未结 11 2250
盖世英雄少女心
盖世英雄少女心 2020-12-07 16:57

I\'m writing a CSV file. I need to write timestamps that are accurate at least to the second, and preferably to the millisecond. What\'s the best format for timestamps in

11条回答
  •  没有蜡笔的小新
    2020-12-07 17:39

    Try MM/dd/yyyy hh:mm:ss a format.

    Java code to create XML file.

    xmlResponse.append("mydate>").append(this.formatDate(resultSet.getTimestamp("date"), "MM/dd/yyyy hh:mm:ss a")).append("");

    public String formatDate(Date date, String format)
    {
        String dateString = "";
        if(null != date)
        {
            SimpleDateFormat dateFormat = new SimpleDateFormat(format);
            dateString = dateFormat.format(date);
        }
        return dateString;
    }
    

提交回复
热议问题