M
M
Mountain Programmer2017-09-29 22:49:35
JavaScript
Mountain Programmer, 2017-09-29 22:49:35

How to format date in milliseconds?

Formatting from milliseconds to a normal date is easy

const optionsTime = {
  year: 'numeric',
  month: 'numeric',
  day: 'numeric',
  hour: 'numeric',
  minute: 'numeric'
};
new Date(1508706000000).toLocaleString('ru', optionsTime);

// "23.10.2017, 0:00"

Actually the question is: is it possible to do the opposite, except to parse the string through split ()? Is there any built-in function in js for reverse formatting?
It is the format that is of interest:
дд.мм.гггг, чч:мм
PS A big request is not to advise you to open Google and the like, you can write an answer - write
And the code produces NaN and not the desired milliseconds
new Date('16.09.2017, 16:39').getTime();
NaN

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question