We help IT Professionals succeed at work.
Get Started

C# WCF DataMember DateTime to string

Last Modified: 2012-05-09

My problem is that WCF is that the run-time serializer converts DateTime data types to a complex Javascript data type ("\/Date(1275609600000-0700)\/")

My application handles the internationalization and timestamps on the server-side. So it is in the correct format for the user in the data object returned using the service.

I want the serializer to treat the data member as a string instead of a datetime.
I do not want to create new data objects for all my services, just because of this datetime flaw.

The data in my object is presented as: 6/3/2010 5:00:00 PM when .ToString() is invoked.
The data in the javascript object is: Thu Jun 03 2010 17:00:00 GMT-0700 (Pacific Daylight Time)

Anyone know how to resolve this?
Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE