10 examples of 'moment get current time' in JavaScript

Every line of 'moment get current time' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
5function getCurrentTime () {
6 var dt = moment ? moment().format('YYYY-MM-DD HH:mm:ss.SSS') : Date.now();
7 return chalk ? chalk.grey(dt) : dt;
8}
26function getCurrentTime() {
27 //return the current time in format TTS can use
28 var d = new Date();
29 var returnString = new String();
30 returnString = " It is now, ";
31 returnString += d.getHours() + " " + d.getMinutes();
32 returnString += ". ";
33 return returnString;
34}
85function getCurrentTime(serverTime) {
86 return serverTime ? serverTime.getTime() : (new Date()).getTime();
87}
12function getCurrentDate() {
13 var now = new Date();
14 return now.toISOString();
15}
52function $time(){
53 return new Date().getTime();
54};
10function getTime(date = new Date()): string {
11 return moment(date).format(`YYYY-MM-DD HH:mm:ss`);
12}
9function mytime() {
10 var date = new Date()
11 return date.getTime();
12}
41function get_time() {
42 return Date.now() + t_offset;
43}
25function getTime() {
26 if (!connected) {
27 return lastUpdateFromServer;
28 }
29 return lastUpdateFromServer + window.performance.now() - timeOfLastUpdateFromServer;
30}
32public static getUnixTimeFor2Days() {
33 return Util.getCurrentUnixTime();
34}

Related snippets