I know that my question is similar to others but I didn't found any solution to my problem.
I have a C# DateTime property
public DateTime MyDate { get;set;}
When I use an ajax to get some information, I wrote in javascript something like:
$.each(object, function(k,v){
alert(object.MyDate);
});
It returns something like:
/Date(1362478277517)/
It is possible to convert that datetime to javascript date ?
Thank you.
To parse, in computer science, is where a string of commands – usually a program – is separated into more easily processed components, which are analyzed for correct syntax and then attached to tags that define each component.
The C/C++ parser is used for C and C++ language source files. The C/C++ parser uses syntax highlighting to identify language elements, including the following elements: Identifiers. Operators.
The strtok function is a handy way to read and interpret data from strings. Use it in your next project to simplify how you read data into your program. By Jim Hall (Correspondent) April 30, 2022 | 0 Comments | 4 min read.
C is compiled with a compiler, which is run once before the program may be run thousands of times. Most C compilers make several 'passes': lexing input into tokens, parsing the tokens into a tree, then modifying the Abstract Syntax Tree to generate symbol tables for each of the scopes of execution.
new Date(object.MyDate);
should work.
EDIT:
var date = new Date(parseInt(object.MyDate.substr(6)));
I've also seen this method:
var milli = "/Date(1245398693390)/".replace(/\/Date\((-?\d+)\)\//, '$1');
var d = new Date(parseInt(milli));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With