javascriptserializer日期格式问题 [英] javascriptserializer date format issue

查看:155
本文介绍了javascriptserializer日期格式问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将具有许多其他类型和列表的属性的复杂对象序列化为JSON形式,但问题是DateTime属性。我使用JavascriptSerializer获得了时间(而不是mm / dd / YYYY)。

I am serializing a complex object with lot of properties of other Types and Lists to JSON form but the issue is with DateTime properties. I get the epoch time with JavascriptSerializer (rather than mm/dd/YYYY).

有什么方法可以获取mm / dd / YYYY格式的日期时间:HH.MM.SS格式,而无需修改我正在序列化的对象的类定义。 / p>

Is there any way I can get the datetime in mm/dd/YYYY : HH.MM.SS form without modifying the class defination of the object i am serialzing.

推荐答案

使用 JavaScriptSerializer 且不修改基础类就无法实现。这可以通过 Json来实现。净

This cannot be achieved using JavaScriptSerializer and without modifying the underlying class. This could be achieved with Json.Net.

这篇关于javascriptserializer日期格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆