Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
>Hi,
I have one record in which i have field"CurrentDate" as 8/27/2014
but when i serialize it using

C#
var invoiceDataSerializer = new JavaScriptSerializer();
var invoiceData= invoiceDataSerializer.Serialize(invoiceSerializedList);


it is coming in "invoiceData" as

C#
[{"Rowno":1,"ProjectName":"Agendia Inc: LIS Maintenance \u0026 Support","EmployeeRoleTypeName":"Developer","WorkHours":25,"InvoiceStartNo":"tf-0256","CurrentDate":"\/Date(1409077800000)\/","TotalWorkingDays":"83","TotalWorkingHrs":"15272","BillableHrs":"897","NonBillableHrs":"272","DateRange":" 5/1/2014 to 8/28/2014"}


further

C#
var excelInvoice = JsonConvert.DeserializeObject<list><invoice>>(invoiceData);



and in excelInvoice for "Current Date "
it is returning 8/26/2014

how is it possible..I am not able to fix this issue.


any help will be appreciable
thanks and regards
Posted
Updated 27-Aug-14 20:33pm
v4
Comments
Jameel VM 28-Aug-14 2:39am    
i think this might be a problem of timezone. I suggest you to convert the CurrentDate to String before serializing.So it will be remains the same.else you should pass timezone(offset) from the client to the server and then try yourDate.Value.AddMinutes(Convert.ToInt32(offsetfromClient)*-1);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900