Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Passing DateTime from c# to javascript function

0
0
Hi again,

Your approach uses several calls into script code to convert a single date. That could perform acceptably, but you might get better performance by minimizing the number of trips across the host-to-script boundary. Consider something like this:
dynamic jsDate = engine.Evaluate("new Date()");
var dt = DateTime.Parse(jsDate.toJSON());
Cheers!

Viewing all articles
Browse latest Browse all 2297