new Date(System.currentTimeMillis()
时间: 2023-10-25 09:03:49 浏览: 200
new Date(System.currentTimeMillis())的作用是获取当前时间并以Date对象的形式返回。System.currentTimeMillis()返回的是当前时间距离1970年1月1日 00:00:00的毫秒数。通过将这个毫秒数传递给new Date()的构造函数,可以将其转换为Date对象。这样可以方便地对日期进行格式化和操作。请注意,如果只需要获取时间戳,并不需要考虑时区等因素,直接使用System.currentTimeMillis()会更高效。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [System.currentTimeMillis()与new Date()](https://blog.csdn.net/qq_37358143/article/details/104928505)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [new Date().getTime()和System.currentTimeMillis()获取时间戳](https://blog.csdn.net/weixin_34253126/article/details/91937032)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Android处理时间各种方法汇总](https://download.csdn.net/download/weixin_38680492/14882857)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文