Reputation: 11
I am getting a date from ActiveX component (developed in .NET. The date format is not known i.e give like DateTime.Now.toString() ). so i am getting date June 8th, 2012 instead of Aug 18th, 2012.. How can i get Aug 18th, 2012 when use new Date()
?
Here is the code:
signerDetails = signerLib.FetchCertDetails();
var certDetails = signerDetails.split('$$$$$$');
var cardDate = new Date(certDetails[1])
Upvotes: 1
Views: 225
Reputation: 82096
I would advise you update your ActiveX component to return the date in RFC2822 or ISO 8601 format, that way you can create a new instance of the date without any sort of manual parsing. Pretty simple to do that in C#, .NET has a built in format specifier e.g.
var iso8601Date = DateTime.UtcNow.ToString("o");
There is an overload of the Date class which takes in the date as string, this internally calls Date.parse which expects the date in that particular format.
Alternatively, you could have your date returned in epoch format however that would require some extra work.
Upvotes: 1