开发者

Calculate Date from seconds, since the A.D 01-01-0001

I want a .NET C#\VB.NET code for followng problem I want to calculate the Date from seconds for example I have 1304393880 seconds and this represents 2011-05-06 and 0900 hrs . So these seconds keep updating on daily basis. so next day I will have 1304393880 + 24*60*60 =1304480280. now when I calculate 1304480280 sec to date at 9 A.M it should give me 201开发者_开发知识库1-05-07-0900 Please help


Whatever language you're working in has some kind of Epoch (the date/time represented by 0 seconds). Simply calculate the #of seconds between that language-specific Epoch, and 01-01-0001, and add that constant to your calculations as appropriate.

Here's the calculation, from WolframAlpha:

http://www.wolframalpha.com/input/?i=seconds+since+0%3A00%2C+01-01-0001

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜