Featured image of post 如何在 C++ 中以 ISO 8601 格式輸出當前時間

如何在 C++ 中以 ISO 8601 格式輸出當前時間

先決條件

  • ISO C++ 20 標準 (/std:c++20)

程式碼

1
2
3
4
#include <chrono>
#include <format>

std::string datetime = std::format("{:%FT%TZ}", system_clock::now());

以上就是在 C++ 中以 ISO 8601 格式輸出當前時間的方法。

參考資料

comments powered by Disqus
使用 Hugo 建立
主題 StackJimmy 設計