10 examples of 'moment get current date' in JavaScript

Every line of 'moment get current date' 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
12function getCurrentDate() {
13 var now = new Date();
14 return now.toISOString();
15}
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

66function getCurrentDate() {
67 date = $("#date-picker").val();
68 time = $("#spinner").val();
69 millis = Date.parse(date + " " + time + " GMT");
70 return new Date(millis)
71}
3export function currentDate(): string {
4 return moment().format('[Today is a] dddd');
5}
657function getMoment () {
658 return ref.clone();
659}
96public getCurrentDate(): string {
97 /* Return current year(string) to display in calendar header. */
98 return this.state.date.year().toString();
99}
98public getCurrentDate(): string {
99 /* Return currently selected year and month(string) to display in calendar header. */
100 return this.state.date.format('MMMM YYYY');
101}
649function getDate () {
650 return ref.toDate();
651}
6function getToday() {
7 var now = new Date();
8 now.setHours(0);
9 now.setMinutes(0);
10 now.setSeconds(0);
11 now.setMilliseconds(0);
12 return now;
13}
116export function currentDateTime(): ISimpleDateTime {
117 return dateToSimpleDateTime(new Date());
118}
308function CurrentDateTime() {
309 var currentdate = new Date();
310 var datetime = "Last Sync: "
311 + (currentdate.getMonth()+1) + "/"
312 + currentdate.getDate() + "/"
313 + currentdate.getFullYear() + " @ "
314 + currentdate.getHours() + ":"
315 + currentdate.getMinutes() + ":"
316 + currentdate.getSeconds();
317 return datetime;
318 }

Related snippets