Announcements
No record found.
How we can change the time format from 24 hrs to 12 hrs with am and pm and date format should be in dd:mm:yyyy?
*This post is locked for comments
Hi Shakti ,
Go to Settings --> Administrator --> System Settings -->Go to Formats tab -->Click on Customize --> Go to time tab and set H or HH.
I am using this code to store the escalation blog and it this date and time formate is not correct and i apply the changes as mentioned above das's post but it is not worked also.
function saveEscalate()
{
var check = Xrm.Page.getAttribute("new_caseesclated").getValue();
var log = Xrm.Page.getAttribute("modifiedon").getValue();
if(check == true)
alert(check);
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
alert(date+" "+time);
Xrm.Page.getAttribute("new_escalatedblog").setValue(log+"\n"+date+" "+time);
}
else
Hi Shakthi,
Try below Script
function saveEscalate() { var check = Xrm.Page.getAttribute("new_caseesclated").getValue(); var log = Xrm.Page.getAttribute("modifiedon").getValue(); if(check == true) { alert(check); date =new Date(); var hours = date.getHours(); var minutes = date.getMinutes(); var day = date.getDate(); var month = date.getMonth()+1; var year = date.getFullYear(); var ampm = hours >= 12 ? 'pm' : 'am'; hours = hours % 12; hours = hours ? hours : 12; // the hour '0' should be '12' minutes = minutes < 10 ? '0'+minutes : minutes; var strTime = hours + ':' + minutes + ' ' + ampm; var fullDate = day+"/"+month+"/"+year; alert(strTime +""+day+"/"+month+"/"+year); Xrm.Page.getAttribute("new_escalatedblog").setValue(log+"\n"+fullDate+" "+strTime); } else { } }
Thanks
Justin Jose
Hi Sakti,
Please check below code,
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
var hours = today.getHours();
var minutes = today.getMinutes();
var ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
if(dd<10)
dd='0'+dd;
if(mm<10)
mm='0'+mm;
today = dd+'/'+mm+'/'+yyyy + ' '+ strTime;
Xrm.Page.getAttribute("new_escalatedblog").setValue(today.toString());// make sure this is text field
Thanks,
Shahbaaz
Check user settings instead of system settings. Go to top corner gear icon --> options -->Go to Formats tab -->Click on Customize --> Go to time tab and set HH :mm , it will work.
Refer here for scripting
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
ScottDurow 2
GJones 1