Advertisement
jargon

Time Format

Sep 21st, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const options = {
  2.     year: 'numeric',
  3.     month: 'long',
  4.     day: 'numeric',
  5.     hour: 'numeric',
  6.     minute: 'numeric',
  7.     hour12: true
  8. };
  9.  
  10. const now = new Date();
  11. const formattedDate = now.toLocaleString('en-US', options);
  12.  
  13. console.log(formattedDate); // Example output: "September 21, 2024, 12:30 PM"
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement