【发布时间】:2021-03-04 18:55:27
【问题描述】:
我尝试在 firestore 中保存日期,但每次都保存为字符串或数字,我需要另存为时间戳
date( 'U', strtotime( '-4 HOUR' ) ); // result something like 1605958160
PHP 示例
$docRef = $db->collection('users')->document('lovelace');
$docRef->set([
'first' => 'Ada',
'last' => 'Lovelace',
'born' => date( 'U', strtotime( '-4 HOUR' ) )
]);
【问题讨论】:
-
架构中的
born列是如何定义的 -
我没有架构,我需要在哪里创建架构?我只是关注这篇文章firebase.google.com/docs/firestore/data-model
标签: php google-cloud-platform google-cloud-firestore