c# - Why a value of type Datetime becomes '01/01/0001 00:00:00' when received?
问题描述
I have very peculiar kind of an issue which is driving me nuts for the last so many months and i come back again and again in hope that I will fix it but cannot.
I have a web service written in c#. I pass it a date but it comes NULL. There are other data fields which are coming ok but this comes as '01/01/0001 00:00:00'
.
private System.DateTime rEQ_STARTField;
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="date")]
public System.DateTime REQ_START {
get {
return this.rEQ_STARTField;
}
set {
this.rEQ_STARTField = value;
}
}
When it is received by the method it becomes like '01/01/0001 00:00:00'.
Sending: (From client)
notif.REQ_START = dtRequestStartDate.Value.Date
REQ_START
value is 3/4/2020
.
I am using Forms.DateTimePicker at client's end but that's not the problem, no matter whatever I assign to it via any tool, it becomes '01/01/0001 00:00:00' once received.
Update:
Upon deserializing I found that the REQ_Start is not even getting transmitted. It's not even in the payload. Why?
解决方案
推荐阅读
- javascript - React.Intl 子字符串来自
- vector - 为什么 &[T] 参数也接受 &Vec
? - r - 插图的解释
- angular - Angular 2:登录后如何将用户重定向到以前的 URL
- android - 无法解析符号“?selectableItemBackgroundBorderless”
- node.js - 节点 Koa cors 不工作
- react-native - 我无法使用 react-native 地图在我的 android 上查看地图
- git - 从 git 中的提交消息中获取文件名
- macos - 通过网络设置两机内核调试
- regex - 创建一个“除特定字符之外的所有内容”正则表达式