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

      <bdo id='54KXV'></bdo><ul id='54KXV'></ul>
    <legend id='54KXV'><style id='54KXV'><dir id='54KXV'><q id='54KXV'></q></dir></style></legend>

  1. <small id='54KXV'></small><noframes id='54KXV'>

    1. <tfoot id='54KXV'></tfoot>
    2. 时间戳值不正确 - c.getTimeInMills()

      时间:2023-07-27

          <tbody id='wxJX2'></tbody>

            <legend id='wxJX2'><style id='wxJX2'><dir id='wxJX2'><q id='wxJX2'></q></dir></style></legend>
          • <small id='wxJX2'></small><noframes id='wxJX2'>

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

              <tfoot id='wxJX2'></tfoot>
              1. 本文介绍了时间戳值不正确 - c.getTimeInMills()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有一个正常工作的 DatePicker,但是,当我将日期转换为时间戳时,时间戳完全错误.请参阅下面的代码:

                I have a DatePicker which is working correctly, however, when I convert the date to a timestamp, the timestamp is completely wrong. Please see my code below:

                final Calendar c = Calendar.getInstance();
                                int mYear = c.get(Calendar.YEAR); // current year
                                int mMonth = c.get(Calendar.MONTH); // current month
                                int mDay = c.get(Calendar.DAY_OF_MONTH); // current day
                                timestamp = c.getTimeInMillis();
                

                c.getTimeInMillis 部分似乎没有得到正确的日期.有谁知道如何解决这个问题?

                The part c.getTimeInMillis does not seem to be getting the correct date. Does anyone know how to fix this?

                预计日期是今天,我得到的是 5/31/51128, 4:47:42 PM.我已经弄清楚为什么它显示错误的日期:生成的时间戳末尾有 3 个额外的数字.我不知道为什么,或者如何解决这个问题.

                Expected date was today’s date and I'm getting 5/31/51128, 4:47:42 PM. I have figured out why it is showing the wrong date: the generated timestamp has 3 extra digits at the end. I don't know why though, or how to fix this.

                推荐答案

                我怀疑您正在将 timestamp(以毫秒为单位)提供给需要秒数的例程.那些3 个额外数字"是时间戳的毫秒部分.如果您觉得这听起来不错,请在传递之前将 timestamp 除以 1000.

                I suspect you are feeding timestamp, which is in milliseconds, to a routine that wants seconds. Those "3 extra digits" are the milliseconds part of the timestamp. If this sounds right to you, divide timestamp by 1000 before passing it on.

                这篇关于时间戳值不正确 - c.getTimeInMills()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在android中将时间戳转换为当前日期 下一篇:将 Date 对象与 Java 中的 TimeStamp 进行比较

                相关文章

                最新文章

                1. <tfoot id='IX6E4'></tfoot>

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

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

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