How to get current time and date in C++?

后端 未结 24 1968
刺人心
刺人心 2020-11-22 06:55

Is there a cross-platform way to get the current date and time in C++?

24条回答
  •  滥情空心
    2020-11-22 07:45

    #include 
    
    void main()
    {
         //Following is a structure to store date / time
    
    SYSTEMTIME SystemTime, LocalTime;
    
        //To get the local time
    
    int loctime = GetLocalTime(&LocalTime);
    
        //To get the system time
    
    int systime = GetSystemTime(&SystemTime)
    
    }
    

提交回复
热议问题