如何在javascript中添加和减去给定时间的1分钟 [英] How to add and subtract 1 minute from the given time in javascript
问题描述
朋友们,
我正在处理每周时间表移动应用程序,用户会在其中显示他/她的每周时间表数据,并根据该人可以决定需要多长时间才能完成每周办公时间。
用户提供复选框(在Office中),当选中复选框时,javascript函数会定期运行每分钟。
在这个函数中,我想写一个逻辑,它从Avg Hrs Req中减去1分钟。比如5:00并且在当前时间加上1分钟说11点41分。
下面是我的表结构,显示给用户
Hello friends,
I'm working on weekly timesheet mobile application, where the user is displayed his/her weekly timesheet data and based on that person can decide how much more time required to complete the weekly office time.
User is provided with checkbox(in Office), when the checkbox is checked the javascript function periodically runs for every minute.
In this function I want to write logic where it subtracts 1 min from the Avg Hrs Req. say 5:00 and adds 1 minute in the Current Time say 11:41.
Below is my table structure which is displayed to the user
Curr. Time: 11:41 Last Refresh: 11:41
Avg Hrs 16:30 2:00 6:00 Hrs 16:00 1:30
8:45 Hrs 18:30 3:30 4:30 Hrs 14:30 3:30
任何想法如何为它编写逻辑?
感谢avdance
Any idea how to write logic for it?
Thanks in avdance
推荐答案
以下是解决方案
Here is the solution for it
(document).ready(function(){
(document).ready(function () {
(document).on(' change',' #chkInOffc',function(){
if (
(document).on('change', '#chkInOffc', function () { if (
这篇关于如何在javascript中添加和减去给定时间的1分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!