cut string in JavaScript using substr function

String : HH:MM:AMPM


syntex : 


var cutstr = string.substr(startIndex , Length) ; 


CODE :- 
<script>
function cutstring(){

btime = 'HH:MM:AMPM ';

var hh = btime.substr(0,2);
var mm = btime.substr(3,2);
var ampm =btime.substr(6,2);
alert(hh);
alert(mm);
alert(ampm);

}
</script>
<b> String :  HH:MM:AMPM </b>
<input type="button" onclick="cutstring()" name="button" value="click " />

Comments

  1. Keeping your youngster healthy should be your main concern, so ensure that you purchase
    only quality baby care products. Other than this, proper baby medicines are widely-used to maintain the health
    with the kids. Her chiropractor performed low
    amplitude, high velocity manipulation along the 3 spinal locations and almost 1.

    ReplyDelete

Post a Comment

If you Satisfied , Please Leave a comment

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress