Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JSON形式でdatetimeを取得しています-
"\/Date(1261413600000+0530)\/"
コードビハインドから、メソッドを使用しDataContractJsonSerializer.ReadObjectてデータを逆シリアル化しています。
DataContractJsonSerializer.ReadObject
変換されたデータの時刻が正しくありません。
コードビハインドから正しいJSON日時を解析するには?
正規表現を使用して、1970年1月1日以降のティック数である数値を取得できます。次に、以下を使用して日付を取得できます。
DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); DateTime dt = unixEpoch.AddSeconds(Convert.ToDouble(ticks));
assume in visual studio i have a method :
[WebMethod] public List<PhongTro> GetAllLodgingHousesByAddress(string address)