Hi Experts,
I am fetching the created on field from one entity via liquid code and trying to convert the date time to Panama timezone. but I am seeing one strange behavior while fetching records via liquid code i.e My Time zone id "Asia/Calcutta" i.e IST and I have inserted one record around 5pm today. below is a screenshot of the same:
Entity Data
But while fetching data from liquid code it is giving me 11:29 AM:
Liquid Code Data
Why is that so? Is this expected? I can see that it is converted to UTC i.e IST-5:30 hr. Please correct me if I am wrong.
And I am trying to convert the DateTime to Panama timezone using Moment.js, I am using below code but it is giving incorrect because I assume from liquid code I am getting incorrect value:
<script src="/MomentJS"></script>
<script src="/moment-timezone.min.js"></script>
<script src="/moment-timezone-with-data.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var data = $.parseJSON(
$.ajax({
url: '/JsonData/',
dataType: "json",
async: false
}).responseText);
//set local
moment.locale('es-PA');
var CreatedDate = data.UserData[0].UserData_CreatedOn;
var date = new Date(CreatedDate);
var dateUTC = moment(date);
var datePanama = dateUTC.tz('America/Panama').format('MM/DD/YYYY h:mm A');
$("#createdon").text(datePanama);
});
below is the output of datePanama variable:
"08/13/2020 12:59 AM"
Any help will be appreciable on this.
Thanks,
Amit