Javascript examples for jQuery Method and Property:trim
Split time into hours, minutes and seconds
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){//from www . j a v a2 s. c o m strDate = "12 : 40 :12"; arr = strDate.split(':'); hour = $.trim(arr[0]) + " hrs"; min = $.trim(arr[1]) + " min"; sec = $.trim(arr[2]) + " seconds"; console.log(hour); console.log(min); console.log(sec); }); </script> </head> <body> </body> </html>