我已将数据从 mongodb 移至 AWS Athena。我需要在 Athena 中使用 SQL 从每条记录的 objectId 中提取时间戳。
我可以在 Postgre、Redshift 等中找到一些示例...但在 Athena 中找不到...
示例输入:
507c7f79bcf86cd7994f6c0e
雅典娜的需求输出:
2012-10-15T21:26:17Z
使用 docs 中的相应函数翻译这个 MySQL 查询看起来很容易管理:
select from_base(substr('507c7f79bcf86cd7994f6c0e', 1, 8), 16);
输出:
_col0
-----------------------------
2012-10-15 21:26:17.000 UTC