javascript - 通过json发送和接收时的日期时间问题
问题描述
我在从角度“Thu Jan 10 2019 00:00:00 GMT+0400 (Gulf Standard Time)”中选择 DateTime 选择器时得到这个日期和时间,我系统中的实际日期时间是 2019 年 1 月 10 日 9.51
在 asp.net api 中接收数据时,我得到了这样的日期。{09/01/2019 晚上 8:00:00}
有角度的。
export interface sample{
vr_date: Date
}
`this.adapter.setLocale('en-GB');` // i use this to get date format in dd/mm/yyyy format
ASP API
public class sample
{
public Nullable<System.DateTime> vr_date{ get; set; }
}
解决方案
在转换为 JSON 之前将日期转换为字符串。
利用-
var date=dateObject.toLocaleDateString();
然后通过 JSON 发送日期。
推荐阅读
- sql - 带有函数返回 VARCHAR2 的 WITH 子句
- encoding - 覆盆子 PICO 的 cmake 文件编码问题
- excel - 需要带有动态字段的sumproduct excel公式
- javascript - 比较两个句子并识别javascript中的错误单词
- vtigercrm - 安装 vtigercrm 7.3 期间的 SQL MODE 错误代码
- amazon-web-services - 在 Rafay 上滚动日志
- amazon-web-services - 将消息发布到 SNS 而不是直接推送到 SQS 的优势
- firebase-storage - Firebase-storage 检索元数据带宽消耗
- autodesk-forge - 批量打开多个 Revit 模型 - 关闭 BIM360
- core-animation - 同步CALayer绘图