-3
// having all variables in a an object.
let student = "";
    student = {
  studentName: fn + ',' + ln.toUpperCase(),
  **date : date.toLocaleDateString(),**
  gender : gender,
  country : country,
  address : address,
  email : email,
};

this is a part of the code. When i run it. it prints in mm/dd/yyyy in the html how to make it print dd/mm/yyyy?

justin
  • 17
  • 4

1 Answers1

0

Did you try passing 'en-GB' as a parameter? From here

In basic use without specifying a locale, a formatted string in the default locale and with default options is returned.

let date = new Date();
console.log('en-GB format:', date.toLocaleDateString('en-GB'));
console.log('en-US format:', date.toLocaleDateString('en-US'));
Dr. Acula
  • 469
  • 6
  • 13