如何在React Native中获取在线当前日期和时间 [英] How to get Online Current Date and Time in React Native
本文介绍了如何在React Native中获取在线当前日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过此命令获取当前时间和日期
I tried to get current time and date by this command
new Date()
但是当我更改手机上的时间时,它根据手机上的时间而改变.
But when I change the time on my phone, It changed base on the time on my phone.
我想实时获取当前时间和日期.请帮我.谢谢您的回复.
I want to get the current time and date in real time. Please help me. Thank you for your response.
推荐答案
例如,您可以使用Internet上的api获取实时信息,例如:
You can get the real time using an api over the internet like this for example:
https://timezonedb.com/api
这篇关于如何在React Native中获取在线当前日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文