主页
C++
C++ 日期和时间
demo_date_asctime
运行 ❯
×
更改方向
保存代码
更改主题
#include
#include
// Import the ctime library using namespace std; int main () { time_t timestamp = time(NULL); struct tm datetime = *localtime(×tamp); cout << asctime(&datetime); return 0; } // Note: This example displays the server's local time, which may differ from your local time.