将时间戳转换为firebase的字符串
在此处输入映像我从firestamp访问了firestamp,并将其打印为字符串,但没有显示出来,但它没有显示以日期格式!我无法在不将其转换为字符串中,也无法将其从Fromat转换为字符串。
enter image description hereI accessed the timestamp from firestore and printed it as an string but it's not showing in date format! I'm not being able to print timestamp inside Text widget without converting it into string fromat either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不想使用Firestore功能,那么将时间戳转换为JavaScript日期或您所说的字符串就是这样的最简单方法:
时间戳是具有秒和纳秒的对象,您可以创建一个日期实例,请通过时间戳秒,并用1000乘。现在您可以根据需要将其格式化。
If you don't want to use Firestore function, than the easiest way to convert a timestamp to a JavaScript date or as you said string is like this:
The timestamp is an object with seconds and nanoseconds, you create an date instance, pass the timestamp seconds and multiply with 1000. Now you can format this as you want.