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

FormatDate of DatePicker in Javascript

1 Answer 67 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 25 May 2012, 07:13 AM
What am I doing wrong here?  I am trying to get a formatted Date out of my datepicker in Javascript that is culture sensitive.



function getDate() {
 
    sender = $find('<%= RadDatePciker1.ClientID %>');
    var selectedDate = sender.get_selectedDate();
    var shortDatePattern = sender.get_calendar().DateTimeFormatInfo.ShortDatePattern;
    var formattedDate = sender.get_calendar().DateTimeFormatInfo.FormatDate(selectedDate, shortDatePattern);
    alert(formattedDate);
 
}

1 Answer, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 25 May 2012, 07:38 AM
Well now, this seems to work, but is this how I am supposed to do this?

function getDate(sender) {
 
    var selectedDate = sender.get_selectedDate();
    var shortDatePattern = sender.get_calendar().DateTimeFormatInfo.ShortDatePattern;
    var formattedDate = sender.get_dateInput().get_dateFormatInfo().FormatDate(selectedDate, shortDatePattern)
    return formattedDate;
 
}
Tags
Calendar
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Share this question
or