查找时间两个日期之间的区别? [英] Find the difference between two dates in hours?

查看:117
本文介绍了查找时间两个日期之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我可以看着他们计算这两个日期的差别,但我不知道,当它涉及到一个程序计算此。

For example I can calculate the difference of these two dates by looking at them but i have no clue when it comes to calculating this in a program.

日期:一个是 2014年2月12日(Y / M / D)13时26分33秒 B是 2014年/ 02 / 14(Y / M / D)11时35分06秒然后小时差是46

Dates: A is 2014/02/12(y/m/d) 13:26:33 and B is 2014/02/14(y/m/d) 11:35:06 then difference in hours is 46.

推荐答案

您可以使用 difftime() 来计算 C 两个时间之间的区别。然而,它使用 mktime TM

You may use difftime() to calculate difference between two times in C. However it uses mktime and tm.

double difftime(time_t time1, time_t time0);

这篇关于查找时间两个日期之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆