This is a migrated thread and some comments may be shown as answers.

[Solved] Get datepicker value

1 Answer 189 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
k
Top achievements
Rank 1
k asked on 18 Feb 2011, 10:57 PM

I am using datepicker, and need to get the value of datepicker in JQuery code. I've tried like the below:
var d = ($('#AsOfDateData').data("tDatePicker").value()); and passing the value of d as string to my action method, in the action method converting that date string to real datetime object using Convert.ToDatetime(d); This is throwing exception: string is not valid datetime because when I get datepicker value in JQuery, the date is in this format "Thu Feb 17 00:00:00 CST 2011". In JQuery, How to get the value of datepicker in MM/dd/yyyy format?

Thanks

1 Answer, 1 is accepted

Sort by
0
k
Top achievements
Rank 1
answered on 18 Feb 2011, 11:51 PM
Nevermind. Solved it with the help of this forum post: http://www.telerik.com/community/forums/aspnet-mvc/datepicker/datepicker-value-in-ajax-post.aspx .

Thanks
Tags
Date/Time Pickers
Asked by
k
Top achievements
Rank 1
Answers by
k
Top achievements
Rank 1
Share this question
or