Moment Timezone Data

by Hugo Carneiro

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<script src="https://momentjs.com/downloads/moment-timezone-with-data.min.js"></script>
<strong>Current time in my time zone</strong>
<pre class="my-time"></pre>
<br>
<strong>Current time in LA</strong>
<pre class="tz-time"></pre>

JavaScript

$('.my-time').html(moment().format('MMMM Do YYYY, h:mm:ss a'));

// What we want to achieve
$('.tz-time').html( moment().tz('America/Los_Angeles').format('MMMM Do YYYY, h:mm:ss a') );