Created
October 13, 2012 17:40
-
-
Save alexsandro-xpt/3885498 to your computer and use it in GitHub Desktop.
Convert .net DateTime to JavaScript Timestamp and vice versa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timestamp = (long)DateTime.UtcNow | |
.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)) | |
.TotalMilliseconds; | |
//http://stackoverflow.com/questions/1877788/javascript-date-to-c-sharp-via-ajax | |
var date = new DateTime(1970, 1, 1).AddTicks(timestamp * 10000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment