admin管理员组文章数量:1290307
I want to subtract 5.30 hours from a date, for example, I have a date:
Fri Jan 15 2016 00:00:00
after subtraction, it should be something like,
Thu Jan 14 2016 19:30:00
How I can achieve this. Any help will be appreciated.
I want to subtract 5.30 hours from a date, for example, I have a date:
Fri Jan 15 2016 00:00:00
after subtraction, it should be something like,
Thu Jan 14 2016 19:30:00
How I can achieve this. Any help will be appreciated.
Share Improve this question asked Feb 17, 2016 at 7:10 VishAlVishAl 3783 silver badges17 bronze badges 1- Are both times in local time? If so, is it ok to return 4 1/2 hours or 6 1/2 hours diff if the time interval overlaps a DST shift? – Joachim Isaksson Commented Feb 17, 2016 at 7:14
1 Answer
Reset to default 10try
var date = new Date("Fri Jan 15 2016 00:00:00");
date.setHours(date.getHours()-5);
date.setMinutes(date.getMinutes()-30);
本文标签: datetimewant to substract 530 hours from a Date javascriptStack Overflow
版权声明:本文标题:datetime - want to substract 5.30 hours from a Date javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741498189a2381929.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论