User Tools

Site Tools


programming:cpp:unixtime

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
programming:cpp:unixtime [2022/05/05 07:46]
odagawa
programming:cpp:unixtime [2022/09/12 08:38] (current)
odagawa
Line 14: Line 14:
  
   // int64_t unixtime_i = 1651736619; // 2022-05-05 16:43:39   // int64_t unixtime_i = 1651736619; // 2022-05-05 16:43:39
-  // time_t now = (time_t)unixttime_t;+  // time_t now = (time_t)unixtime_t;
      
   time_t now = std::time(nullptr); // 現在時刻   time_t now = std::time(nullptr); // 現在時刻
-  tm *tm_event = localtime(&unixtime); // 現地時間に直す+  tm *tm_event = localtime(&now); // 現地時間に直す
      
   int year = tm_event->tm_year + 1900; // tm_year は 1900 年始まり   int year = tm_event->tm_year + 1900; // tm_year は 1900 年始まり
Line 47: Line 47:
 }; };
 </code> </code>
 +
 +[[https://tool.konisimple.net/date/unixtime|Unixtime 変換ツール]]
programming/cpp/unixtime.1651736802.txt.gz · Last modified: 2022/05/05 07:46 by odagawa