Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get last two digits of year javascript

 maskDate(date) {
    // console.log(date);
    var dateVar = new Date(date);
    // console.log("XX/XX/"+ dateVar.getFullYear().toString().substr(-2));
    return "XX/XX/"+ dateVar.getFullYear().toString().substr(-2);
 }
Comment

js get current year last 2 digits substring

//new 
const date = new Date("01/20/2021"); // 20th January 2021
const year = date.getFullYear(); // 2021

const year2digits = year.toString().substring(2);

console.log(year2digits); // "21"
Comment

PREVIOUS NEXT
Code Example
Javascript :: js fetch queryselector 
Javascript :: react-bootstrap sidebar 
Javascript :: how to destructure props in react 
Javascript :: react pass variable from child to parent 
Javascript :: moment set time 
Javascript :: js array 0 to n 
Javascript :: calling angular component method in service 
Javascript :: how to create thumbnail image from video in javascript 
Javascript :: cypress graphql request 
Javascript :: new date() javascript 
Javascript :: connected-react-router error could not find router reducer in state tree 
Javascript :: jsx babel webpack 
Javascript :: js blur element 
Javascript :: javascript create folder 
Javascript :: node js require all function from another file 
Javascript :: check if the element exists in javascript 
Javascript :: js date get hours 
Javascript :: js mysql date format and dmy format 
Javascript :: ordenar un array de menor a mayor 
Javascript :: async function syntax in javascript 
Javascript :: secure cookie in javascript 
Javascript :: how to count the rows of gridview in asp.net using jquery 
Javascript :: react onchange handler 
Javascript :: onpress setstate react native 
Javascript :: javascript style guide 
Javascript :: How To Add A New Element To HTML DOM 
Javascript :: pdf to json online 
Javascript :: array with unique values javascript 
Javascript :: check if radio button is selected jquery 
Javascript :: nodejs process code 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =