【发布时间】:2013-06-25 04:26:44
【问题描述】:
我有一个表单,有两个文本输入(两个时间戳)如下:
时间戳开始 [] 时间戳结束[]
两个时间戳都将使用两个按钮自动填充: [Set Start] 和 [Set End],以格式(24h)读取本地时间戳:
2013-06-27 23:55
TimeStamp start 是操作员开始填写表格的时间,而 TimeStamp end 是表单结束填写的时间(这些事件之间的延迟也可以是 1 小时)
然后通过 POST 将数据处理到脚本 PHP
如何在客户端(JS、JQuery?)处理这个时间戳设置
提前致谢
@manraj82
我发现这个 JS 函数可以用 JS 获取时间戳
function getTimeStamp() {
var now = new Date();
return ((now.getMonth() + 1) + '/' + (now.getDate()) + '/' + now.getFullYear() + "
" + now.getHours() + ':' + ((now.getMinutes() < 10) ? ("0" + now.getMinutes()) :
(now.getMinutes())) + ':' + ((now.getSeconds() < 10) ? ("0" + now.getSeconds()) :
(now.getSeconds())));
}
现在我必须将它关联到两个按钮
【问题讨论】:
-
你有试过的代码吗?
-
找到上面的js函数获取时间戳:
标签: javascript forms text input timestamp