3 examples of 'new date .gettime' in JavaScript

Every line of 'new date .gettime' 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
this disclaimer
25function getTime() {
26 var time = Date.parse('2017-05-21');
27 return new Date(time + 3600 * 1000 * (config.sun - 8));
28}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

47function getTime() {
48 return new Date().getTime()
49}
96export function createDate(date) {
97 if (typeof date === 'string') {
98 const [dateString, timeString] = date.split(' ');
99 const args = dateString.split('-');
100 args[1] = args[1] - 1;
101 if (timeString) {
102 args.push.apply(args, timeString.split(':'));
103 }
104 return new Date(...args);
105 }
106 if (!date) return new Date();
107 return new Date(date);
108}

Related snippets