flutter - Flutter Firstore 时间戳现在/当前日期
问题描述
以下是我使用并发现很方便的所有 Firebase 时间戳方法。
解决方案
如何获取 Firestore 时间戳(今天日期)
Timestamp timestampDate = Timestamp.now();
如何从日期时间设置时间戳
DateTime someDate = DateTime.now();
Timestamp timestampDate = Timestamp.fromDate(DateTime(someDate.year, someDate.month, someDate.day))
如何从时间戳中获取日期对象
DateTime dateTime = timestampDate.toDate();
推荐阅读
- javascript - 隐藏日期时间选择器的日期部分的 Javascript - 仅显示小时和分钟
- python - 使用给定参数作为 Python 中另一个参数的默认值
- reactjs - 如何在 S3 上托管非静态 React SPA 应用程序
- matplotlib - 使用 jupyter + matplotlib + imshow 控制工具栏和标题栏
- quill - 为什么自定义内联印迹与先前插入的印迹合并/组合
- javascript - 在 iframe 预订表单中选择元素时出现问题
- ibm-midrange - 在 RPG IV 中找不到 DSPF 的外部描述
- django - Django Query 许多关系“包含”
- java - 如何解决 Wicket 错误:无法找到资源
- r - format.pval() 中的位数错误?