Skip to content

Instantly share code, notes, and snippets.

@phpmaps
Created August 24, 2023 02:24
Show Gist options
  • Save phpmaps/3abc2f0514647a05c51ec78744fe18ee to your computer and use it in GitHub Desktop.
Save phpmaps/3abc2f0514647a05c51ec78744fe18ee to your computer and use it in GitHub Desktop.
Javascript fun string date
const stringDate = () => {
const d = new Date();
d.setHours(d.getHours() - 8);
return `${d.getUTCMonth() + 1}-${d.getUTCDate()}-${d.getUTCFullYear()}-${d.valueOf()}`;
}
console.log(stringDate()); // "8-23-2023-1692814955203"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment