I will be selecting the date using data picker and after selecting the date i need to get the date in mm/dd/yyyy and hh:mm:ss with my below code i am able to acheive thatbut the problem is if it is evening 6:10 i am getting 18:10 only thing is i am not getting 18:10:00 and if it is 18:10:01................. 18:10:59 i am getting them but again if it is 18:11:00 i am getting only 18:11 but i need to get along with 00 seconds also
I am able to get the date with mm/dd/yyyy hh:mm:ss using this below code
string todaydatenew = todaydate.ToString("MM/dd/yyyy hh:mm:ss");
but using this below code i am not getting seconds
EndDate = ViewState["ToDate"].ToString();
DateTime end = DateTime.Parse(EndDate);
EndDate = Request.Form[txtEndDate.UniqueID];
DateTime end = DateTime.Parse(EndDate);
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.dynDateTime.min.js" type="text/javascript"></script>
<script src="Scripts/calendar-en.min.js" type="text/javascript"></script>
<link href="Styles/calendar-blue.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
DatePic();
});
function DatePic() {
$("#<%=txtStartDate.ClientID %>").dynDateTime({
showsTime: true,
ifFormat: "%m/%d/%y %H:%M",
daFormat: "%l;%M %p, %e %m, %Y",
align: "BR",
electric: false,
singleClick: true,
displayArea: ".siblings('.dtcDisplayArea')",
button: ".next()",
});
$("#<%=txtEndDate.ClientID %>").dynDateTime({
showsTime: true,
ifFormat: "%m/%d/%y %H:%M",
daFormat: "%l;%M %p, %e %m, %Y",
align: "BR",
electric: false,
singleClick: true,
displayArea: ".siblings('.dtcDisplayArea')",
button: ".next()"
});
}
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
DatePic();
}
});
};
</script>
<asp:TextBox ID="txtEndDate" runat="server" ReadOnly="True" Visible="true" Width="250px" onchange="checktoDate()" CssClass="txtbx"></asp:TextBox