Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何从asp.net webapi在azure cosmosdb中存储日期时间_Reactjs_Asp.net Web Api_Azure Cosmosdb - Fatal编程技术网

Reactjs 如何从asp.net webapi在azure cosmosdb中存储日期时间

Reactjs 如何从asp.net webapi在azure cosmosdb中存储日期时间,reactjs,asp.net-web-api,azure-cosmosdb,Reactjs,Asp.net Web Api,Azure Cosmosdb,我是Azure CosmosDB的新手。我正在开发一个asp.net webapi,将一个人的出生日期存储到Azure CosmosDB中。我的数据类型是DateTime。在我的例子中,将出生日期保存到azure cosmosdb的最佳方法是什么 当我存储为datetime时,若未提供dateofbirth,则存储为: "dateOfBirth": "0001-01-01T00:00:00", 你看过酒店了吗?您只需要将类型存储为 public Dat

我是Azure CosmosDB的新手。我正在开发一个asp.net webapi,将一个人的出生日期存储到Azure CosmosDB中。我的数据类型是DateTime。在我的例子中,将出生日期保存到azure cosmosdb的最佳方法是什么

当我存储为datetime时,若未提供dateofbirth,则存储为:

 "dateOfBirth": "0001-01-01T00:00:00",
你看过酒店了吗?您只需要将类型存储为

public DateTime dateOfBirth { get; set; }

如果值不可用,则只需提供相同格式的默认时间,或者使用默认时间戳

,因为
DateTime
是一种值类型,其默认值不是
null
。如果希望字段填充为
null
(或根本不创建,具体取决于序列化程序设置),可以使用
DateTime?
使其可为null。所有其他值类型也一样,如
int
double
bool
等。。。