<small id='AxuUi'></small><noframes id='AxuUi'>

<i id='AxuUi'><tr id='AxuUi'><dt id='AxuUi'><q id='AxuUi'><span id='AxuUi'><b id='AxuUi'><form id='AxuUi'><ins id='AxuUi'></ins><ul id='AxuUi'></ul><sub id='AxuUi'></sub></form><legend id='AxuUi'></legend><bdo id='AxuUi'><pre id='AxuUi'><center id='AxuUi'></center></pre></bdo></b><th id='AxuUi'></th></span></q></dt></tr></i><div id='AxuUi'><tfoot id='AxuUi'></tfoot><dl id='AxuUi'><fieldset id='AxuUi'></fieldset></dl></div>

    <legend id='AxuUi'><style id='AxuUi'><dir id='AxuUi'><q id='AxuUi'></q></dir></style></legend>
      • <bdo id='AxuUi'></bdo><ul id='AxuUi'></ul>

      <tfoot id='AxuUi'></tfoot>

      将 XMLGregorianCalendar 转换为 java.sql.Timestamp

      时间:2023-07-26
      <tfoot id='zUrXw'></tfoot>

        <tbody id='zUrXw'></tbody>
        1. <i id='zUrXw'><tr id='zUrXw'><dt id='zUrXw'><q id='zUrXw'><span id='zUrXw'><b id='zUrXw'><form id='zUrXw'><ins id='zUrXw'></ins><ul id='zUrXw'></ul><sub id='zUrXw'></sub></form><legend id='zUrXw'></legend><bdo id='zUrXw'><pre id='zUrXw'><center id='zUrXw'></center></pre></bdo></b><th id='zUrXw'></th></span></q></dt></tr></i><div id='zUrXw'><tfoot id='zUrXw'></tfoot><dl id='zUrXw'><fieldset id='zUrXw'></fieldset></dl></div>

          <small id='zUrXw'></small><noframes id='zUrXw'>

              • <bdo id='zUrXw'></bdo><ul id='zUrXw'></ul>
                <legend id='zUrXw'><style id='zUrXw'><dir id='zUrXw'><q id='zUrXw'></q></dir></style></legend>

              • 本文介绍了将 XMLGregorianCalendar 转换为 java.sql.Timestamp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试将 XMLGregorianCalendar 日期分配给 java.sql.Timestamp var,就像这样...

                I'm trying to assign a XMLGregorianCalendar date to a java.sql.Timestamp var, like this...

                var1.setTimeStamp(Timestamp.valueOf(var2.getXMLGregorianCalendar().toString()))
                

                但显然,这不起作用,并引发异常...

                But apparently, this is not working, and throws an exception...

                java.lang.IllegalArgumentException: 时间戳格式必须是 yyyy-mm-dd hh:mm:ss[.fffffffff]

                java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]

                我也试过这个:

                var1.setTimeStamp((Timestamp) var2.getXMLGregorianCalendar().getTime())
                

                但是……

                java.lang.ClassCastException: java.util.Date 不能转换为 java.sql.Timestamp

                java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Timestamp

                任何想法..?谢谢!

                推荐答案

                我找到了答案:

                    Timestamp timestamp = new Timestamp(var2.getXMLGregorianCalendar().toGregorianCalendar().getTimeInMillis());
                    var1.setTimeStamp(timestamp);
                

                这篇关于将 XMLGregorianCalendar 转换为 java.sql.Timestamp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Android将中部时间转换为当地时间 下一篇:如何为秒值打印高达 6 位精度的时间

                相关文章

                最新文章

              • <i id='jdars'><tr id='jdars'><dt id='jdars'><q id='jdars'><span id='jdars'><b id='jdars'><form id='jdars'><ins id='jdars'></ins><ul id='jdars'></ul><sub id='jdars'></sub></form><legend id='jdars'></legend><bdo id='jdars'><pre id='jdars'><center id='jdars'></center></pre></bdo></b><th id='jdars'></th></span></q></dt></tr></i><div id='jdars'><tfoot id='jdars'></tfoot><dl id='jdars'><fieldset id='jdars'></fieldset></dl></div>

                  • <bdo id='jdars'></bdo><ul id='jdars'></ul>
                1. <small id='jdars'></small><noframes id='jdars'>

                  <tfoot id='jdars'></tfoot>

                  1. <legend id='jdars'><style id='jdars'><dir id='jdars'><q id='jdars'></q></dir></style></legend>