C葃DateTime转JavaScript Date

330 ワード

@{

    var minTicks = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks;

    var nowTicks = DateTime.Now.ToUniversalTime().Ticks;

    var ticks = (nowTicks - minTicks) / 10000L;

}

<script>

    var date = new Date(@ticks);



    document.writeln(date.toLocaleString());

</script>