SharePoint Store the date& time Field as UTC format , when we retrive the datatime flied it will return as UTC format,
i use moment.JS to convert date & time , you can download from https://momentjs.com/
download the moment.js and add the reference Js or any file where your fetching this date.
<script type="text/javascript" src="/path to Jquery/jquery-1.12.2.min.js"></script>
<script type="text/javascript" src="/path to Momentjs//moment.js"></script>
var StartTime= (item.ProgramStartDate);
console.log("Date Before Conversion: " +StartTime );
StartTime= moment(StartTime).format('DD-MM-YYYY');
console.log("Date Before Conversion: " + StartTime);
Result will be like below.
I use dd-mm-yyyy Format. there are many other formats are available in momentjs.
No comments:
Post a Comment