title: Can you get the date format pattern from a date string with Moment.js
body: <p>I want to be able to get the date format string from a date string in JavaScript.</p>
  
  <p>I also am using Moment.js as well if this can be achieved using this.</p>
  
  <p>As an example if I have a string such as </p>
  
  <blockquote>
    <p>2019-01-01 15:00:00</p>
  </blockquote>
  
  <p>I'd like something like this returned</p>
  
  <blockquote>
    <p>YYYY-MM-DD HH:mm:ss</p>
  </blockquote>
  
  <p>I've searched the documentation but cannot find any answers to this.</p>