添加秒到日期 [英] add seconds to a date

查看:158
本文介绍了添加秒到日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为日期添加秒。
例如,如果我有一个日期如2009127000000,我需要添加秒到这个日期。
另一个例子,添加50秒到20091231235957。

I need to add seconds to a date. For example, if I have a date such as 2009127000000, I need to add the seconds to this date. Another example, add 50 seconds to 20091231235957.

这可能在C?

推荐答案

C日期/时间类型time_t实现为自特定日期以来的秒数,所以要添加几秒钟,您只需使用普通算术。如果这不是你所问的,请让你的问题更清楚。

The C date/time type time_t is implemented as the number of seconds since a certain date, so to add seconds to it you simply use normal arithmetic. If this is not what you are asking about please make your question clearer.

这篇关于添加秒到日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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