I'm trying to send via POST or PUT a simple DateTime property in UNIX time format:
{ ... "Created": "/Date(1307871513107+0700)/" ... }
to my ASP.NET MVC 4 WEBAPI action:
...
// PUT /api/<controller>/<action>
public HttpResponseMessage PutUser(UserInfo userInfo)
{
...
UserInfo is a usual model
...
public DateTime Created { get; set; }
...
which is used for EF4 DbContext
...
public class DgDbContext : DbContext
{
public DbSet<UserInfo> UserInfo { get; set; }
...
In debugging and getting my model in controller's action, I have my DateTime prop, but in wrong format:
{01.01.0001 0:00:00}
Where is my mistake and how I can fix it?
All the other fields are getting correct. Strings like "dd.MM.yyyy hh:mm:ss" are working good. I've tried to send:
- { "Created": "Date(1307871513107)" }
- { "Created": "/Date(1307871513107)/" }
- { "Created": "/Date(1307871513107)/" }
- { "Created": "\Date(1307871513107)\" }
- etc.
Thanks.