C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Date getMilliseconds() methodThe JavaScript date getMilliseconds() method returns the value of milliseconds in specified date on the basis of local time. SyntaxThe getMilliseconds() method is represented by the following syntax: dateObj.getMilliseconds() ReturnAn integer value between 0 and 999 that represents milliseconds in specified date. JavaScript Date getMilliseconds() method exampleHere, we will understand getMilliseconds() method through various examples. Example 1Let's see an example to print current milliseconds. <script> var milli =new Date(); document.writeln(milli.getMilliseconds()); </script> Output: 238 Example 2Let's see an example to print the value of milliseconds from the given time. <script> var milli =new Date("August 15, 1947 20:22:10:565"); document.writeln(milli.getMilliseconds()); </script> Output: 565 Example 3Let's see an example to print complete current time. <script> var milli=new Date(); document.writeln(milli.getHours()+":"); document.writeln(milli.getMinutes()+":"); document.writeln(milli.getSeconds()+":"); document.writeln(milli.getMilliseconds()); </script> Output: 13: 43: 32: 963
Next TopicJavaScript Math
|