如何在服务器中存储本地时间 [英] how to store a local time in server

查看:142
本文介绍了如何在服务器中存储本地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Server中插入本地时间。但未能插入



因为我希望本地时间为yyyy-mm-dd HH:mm:ss (24小时)格式。但我转换错误



可以任何人帮助我..



谢谢高级..

解决方案

通常在SQL服务器端更改日期格式 SET DATEFORMAT [ ^ ]命令。



 < span class =code-keyword> SET  DATETIMEFORMAT ymd; 

INSERT INTO ...





但是如果你想使用JavaScript在客户端机器上获取本地时间,请参阅:

http://stackoverflow.com/questions/6838197/get-local-date-string-and-time-string [ ^ ]


如果您理解这个概念,只需阅读此查询

http://stackoverflow.com/questions/13207956/get-server-time-and-insert-into-mysql-table-via-a-表格 [ ^ ]


参考这些链接



javascript日期和时间对象 [ ^ ]



JavaScript getTimezoneOffset()方法 [ ^ ]



JavaScript日期格式 [ ^ ]



问候......:笑:


I am Trying to Insert the local Time in Server.But failed to insert

as i want local Time as yyyy-mm-dd HH:mm:ss(24hrs) format.but I am conversion errors

can Anybody Help me..

Thanks in Advance..

解决方案

Usually to change date format on SQL server side SET DATEFORMAT[^] command is used.

SET DATETIMEFORMAT ymd;

INSERT INTO ...



But if you want to get local time on client machine using JavaScript, see this:
http://stackoverflow.com/questions/6838197/get-local-date-string-and-time-string[^]


if you understand the concept just read this query
http://stackoverflow.com/questions/13207956/get-server-time-and-insert-into-mysql-table-via-a-form[^]


Refer to these links

javascript date and time object[^]

JavaScript getTimezoneOffset() Method[^]

JavaScript Date Format[^]

Regards.. :laugh:


这篇关于如何在服务器中存储本地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆