具有可设置时间的 jQuery javascript 时钟?
我正在寻找一个简单的 jQuery 时钟。
那里有很多,但我正在寻找一个可以设置当前时间和输出格式的。
所以我希望能够调用类似的东西
$('#clock').clock({
format: 'l dS F Y, h:i a', //PHP date format, but anything that can mimic this output is good
date: '2012-07-01 23:59:59' //MYSQL date format, but can output as anything
});
是否有类似的东西(即使是原始js也可以)。
I am looking for a simple jQuery clock.
There are tonnes out there, but I am looking for one where I can set the current time, and the output format.
So I want to be able to call something like
$('#clock').clock({
format: 'l dS F Y, h:i a', //PHP date format, but anything that can mimic this output is good
date: '2012-07-01 23:59:59' //MYSQL date format, but can output as anything
});
Is there something like this (even raw js will do).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建时钟计数器非常简单,您编写一个计数器的时间可能比查看此处得到的答案所需的时间要短。下面是我制作的一个原型继承的示例。
只需按照您喜欢的方式格式化输出,将 CSS 添加到您心中的内容即可使其看起来不错。
编辑
通用日期格式函数: http://blog.stevenlevithan.com/archives/date- time-format
一个特定函数,用于将日期格式化为 2011 年 7 月 5 日星期二上午 10:31:
Creating a counter for a clock is pretty simple, you can probably write one in less time that it takes to review the answers you'll get here. Below is one I made as an example of prototype inheritance.
Just format the output however you like, add CSS to your hearts content to make it look good.
Edit
A generic date format function: http://blog.stevenlevithan.com/archives/date-time-format
A specific function to format a date to be like Tuesday 05th July 2011, 10:31 am: