I Wants to get the server Date in Dynamic crm 2011
through new Date() i am getting only the system time.
I Wants to get the server Date in Dynamic crm 2011
through new Date() i am getting only the system time.
Your question really isn't very unclear Hashim. You are trying new Date();
which is JScript. As this is client-side it will not look to the server to retrieve the date and hence you get local system time rather than server time.
You will need code to execute on the server-side to get server time. One solution is a plugin and you would simply use var myDate = DateTime.Now;
to get the current system time.
You haven't elaborated on how you wish to use this so I can't tell you what to do with this value now you have it - but perhaps you are using it to populate an entity attribute, e.g. in a pre-update plugin:
if (pluginContext.InputParameters.Contains("Target") &&
pluginContext.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parmameters.
var entity = (Entity)pluginContext.InputParameters["Target"];
// get current date/time
var now = DateTime.Now;
entity.Attributes.Add("new_mydatetimefield", now);
}