0

I have this textual date: "4 September 2022" (literally a text label inserted manually)

How can I convert it in timestamp with jQuery?

isherwood
  • 58,414
  • 16
  • 114
  • 157
hhh
  • 394
  • 2
  • 15

1 Answers1

1

You can do it using new Date() & getTime()

Check this example.

const timestamp = new Date("4 September 2022").getTime();

console.log(timestamp);
Vijay Hardaha
  • 2,411
  • 1
  • 7
  • 16
  • 1
    Note: this is not guaranteed to work across all browsers. See [What are valid Date Time Strings in JavaScript?](https://stackoverflow.com/q/51715259/215552) – Heretic Monkey Sep 16 '22 at 16:32