I am using ASP.Net ajax calendar extender control to display date and time.
<asp:TextBox ID="tbxReceivedDate" CssClass="selectstyle" runat="server" MaxLength="100" Width="200" onblur="parseStringtoDateTime();"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="tbxReceivedDate" Format="ddd MM/dd/yyyy hh:mm:ss tt" runat="server"></cc1:CalendarExtender>
This textbox returns datetime in this format "Tue 08/18/2015 4:44:40 PM" and I want to convert it to "08/18/2015 4:44:40 PM" in JavaScript.
Below code only selects date part, I also want the time part.
<script type="text/javascript">
function parseStringtoDateTime() {
var date = $find("behaviorID").get_selectedDate();
}
</script>
How can I get this result?
It looks like you only want to remove first 4 characters.
Assuming you have a variable str="Tue 08/18/2015 4:44:40 PM"
, then you just need var mydate = date.substring(3);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.