简体   繁体   中英

How to Get user preview time in CRM 2011 from using odata ,Javascript

when i get date and time from odata query in Javascript web resource , it is get deferent from the value in witch is showing in crm form (DateTime filed)

i used this code to format datetime

function formatDate(dt) {
    dt = dt.replace("/Date(", "");
    dt = dt.replace(")/", "");
    var date = new Date(parseInt(dt, 10));
    return date;
}

在此处输入图片说明

http://charithrajapaksha.blogspot.com/2013/05/working-with-date-and-time-values-in.html

this link show how to solve this problem in C# but i want it using Javascript

How can i solving this matter

Date Time in CRM is stored in UTC and that is why it's off. You'll need to convert your Date Time to the Date Time of the user. Here is how to convert it to the user's browser time .

I will caution you that ideally you should be looking up the user's actual time zone within CRM, but I'd imagine 95% of the time this should work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM