Sajid Khan

Sajid Khan

  • NA
  • 56
  • 11.4k

how to change the selected date format comes from clndr etdr

Dec 13 2016 4:19 AM
how to change the selected date format comes from calendar extender? i need 'mm-dd-yyyy' format.
here's the code:
 
<script language="javascript" type="text/javascript">
function CheckForBackDate(sender, args) {
var selectedDate = new Date();
selectedDate = sender._selectedDate;
var todayDate = new Date();
var grid = document.getElementById("gvDist");
var c = document.getElementsByTagName("table");
// Compare with today date
if (selectedDate.getDateOnly() > todayDate.getDateOnly())
{
sender._selectedDate = todayDate;
sender._textbox.set_Value(sender._selectedDate.format(sender._format));
alert(selectedDate.getDateOnly());
}
} 
 //calling from:
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtCloseDate"
OnClientDateSelectionChanged ="CheckForBackDate"
OnClientShown="ChangeCalendarView" PopupButtonID="imgStartDate" Format="MM-dd-yyyy" >
 

Answers (2)