有没有像java时间戳一样的xml时间戳格式? [英] Is there an xml timestamp format like the java timestamp?

查看:44
本文介绍了有没有像java时间戳一样的xml时间戳格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 java 时间戳具有以下格式:

My java timestamp has the following format:

YYYY-MM-DD hh:mm:ss.ms
2016-01-08 15:16:44.554

我使用以下方法得到它:

I got it using the following method:

private String getCurrentTimeStamp() {

    Date date= new java.util.Date();        
    return((new Timestamp(date.getTime())).toString());

}

时间戳是否有标准化的 xml 日期和时间格式?xs: dateTime 的格式如下:"YYYY-MM-DDThh: mm: SS" 并且不考虑毫秒.

Is there a standardized xml date and Time format for timestamp? The xs: dateTime has the following format: "YYYY-MM-DDThh: mm: SS" And it is not taking into consideration milliseconds.

推荐答案

如果你不能改变架构,你必须改变你的功能

If you can't change the schema, you have to change your function

private String getCurrentTimeStamp() {
    Date date = new java.util.Date();        
    return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(date);
}

这篇关于有没有像java时间戳一样的xml时间戳格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆