weixin_33701617 2012-01-26 19:29 采纳率: 0%
浏览 50

jQuery时间和日期

I am looking for a time output using jQuery, for example, would be great to know what time it is on the visitor's browser and the current day (friday,saturday,monday, etc...).

Is there any way to do it only with jQuery? I don't really like the way javascript handles time issues.

If you recommend any plugin, please tell me wich.

Thanks so much! Souza.

EDIT:

I'm looking to avoid substring javascript outputs, or convert the results.

Wouldn't be great to use

$("#setime").yourtime("day"); 

and give me the day? or

 $("#setime").yourtime("hour", 24format);

and give you the hour in any format you need?

?

  • 写回答

2条回答 默认 最新

  • weixin_33717298 2012-01-26 19:31
    关注

    Try:

    var currentTime = new Date();
    

    It's not jQuery but it will do what you want.

    You also have:

    var month = currentTime.getMonth()
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    var hours = currentTime.getHours()
    var minutes = currentTime.getMinutes()
    

    To play with.

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!