FormatDate of DatePicker in Javascript

2 posts, 0 answers
  1. Dan
    Dan avatar
    124 posts
    Member since:
    Feb 2011

    Posted 25 May 2012 Link to this post

    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);
     
    }
  2. Dan
    Dan avatar
    124 posts
    Member since:
    Feb 2011

    Posted 25 May 2012 Link to this post

    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;
     
    }
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top