1

I am working on an ASP .net MVC application.

I have a System.DateTime? property say creationDate, which gets its value assigned from controller code. In my javascript I have access to this value, and I wanted to display this value in mm/dd/yyyy format in my grid. But I am not sure on how to convert System.Datetime? of c# to a javscript date or datestring value? Any help would be appreciated.

1 Answer 1

2

You can instantiate a new Date() with arguments for year, month and day. However, months is zerobased (0 for january).

just produce the valid javascript in your view.

var d = new Date(2010, 2, 15);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.