PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   疑難雜症區 (https://www.pcdvd.com.tw/forumdisplay.php?f=34)
-   -   找小時數回推的軟體 (https://www.pcdvd.com.tw/showthread.php?t=1102983)

sam8512083 2016-04-20 04:35 PM

找小時數回推的軟體
 
有沒有那種
輸入小時數可以直接推算回是從哪天開始計數的軟體?

Jiun Yu 2016-04-20 09:39 PM

1個附加檔案
這樣? 這東西直接自己寫一個比較快



代碼:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define SECS_PER_HOUR 3600

int main(int argc, char *argv[])
{
   int curr_time = (int)time(NULL);
   int h;
   int new_time;

   h = (argc == 2) ? atoi(argv[1]) : 0;

   new_time = curr_time - (h * SECS_PER_HOUR);

   printf("%s\n", asctime(localtime((time_t *)&new_time)));

   return 0;
}

sam8512083 2016-04-21 11:00 PM

引用:
作者Jiun Yu
這樣? 這東西直接自己寫一個比較快

http://imgur.com/LiLQfHe.jpg


#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define SECS_PER_HOUR 3600

int main(int argc, char *argv[])
{
int curr_time = (int)time(NULL);
int h;
int new_time;

h = (argc == 2) ? atoi(argv[1]) : 0;

new_time = curr_time - (h * SECS_PER_HOUR);

printf("%s\n", asctime(localtime((time_t *)&new_time)));

return 0;
}



超感謝

好用
原本打算改問excel 公式來研究

再次謝謝唷!


所有的時間均為GMT +8。 現在的時間是03:28 AM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。