从C#返回的日期值接受的JavaScript日期格式

时间:2010-04-11 16:31:25

标签: c# .net javascript

任何人都可以帮助从JavaScript日期时间utc格式中获取确切的值。我正在使用一个返回日期的C#web方法,我必须使用Timezone设置该日期。谢谢

1 个答案:

答案 0 :(得分:1)

请检查以下代码:

<script language="javascript">
ourDate = new Date();
document.write("The time and date at your computer's location is: "
+ ourDate.toLocaleString()
+ ".<br/>");
document.write("The time zone offset between local time and GMT is "
+ ourDate.getTimezoneOffset()
+ " minutes.<br/>");
document.write("The time and date (GMT) is: "
+ ourDate.toGMTString()
+ ".<br/>");
</script>

HTH