javascript get current month
// Find current month in JavaScript
const localDate = new Date();
const months = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];
let currentMonth = months[localDate.getMonth()];
console.log(currentMonth);new Date().getMonth(); //note that Jan=0, Dec=11 (annoying I know)var Xmas95 = new Date();
var options = { month: 'long'};
console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95));
// December
console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95));
// Dezember
var today = new Date();
var month = today.getMonth(); // Returns 9
console.log(month); // Output: 9
Also in JavaScript:
- react native android version code
- javascript cut string
- find particular object from array in js
- jhow to make a fish in javascript
- document.ready()
- react native webview postmessage example
- javascript objet keys comparaison
- How to make PWAs installable js
- js email regex
- Write Number in Expanded Form
- react array if id is present do not add element
- javascript delete first character in string
- sort array of objects javascript by value
- jquery append
- Javascript get random item from array
- get children length jquery
- Material-ui add circle icon
- angular download blob pdf
- node cluster
- pass header in axios
- mdn error 404
- javascript rpg tutorial
- react how to block render if data is not fetched yet
- checking if a character is an alphabet in js