std::put_time formats

后端 未结 2 1022
栀梦
栀梦 2021-01-14 08:24

I want understand how to work std::put_time, and how can I get date stamp in \"YYYY/MM/DD HH:MM:SS\" format. Now I write somthing like this:

std::chrono::tim         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-14 09:04

    As mentioned 1 hour ago here, cppreference has good documentation on this: http://en.cppreference.com/w/cpp/io/manip/put_time

    Specifically, you can get the format you described using the following format string:

    std::cout  << std::put_time(std::localtime(&now_c), "%Y/%m/%d %T")
    

提交回复
热议问题