visual studio - How to assign current system time to a String^ variable? -
how can current system time @ button click event , assign string^
variable in (possibly) specified format (like:yyyy-mm-dd-hh-mm-ss)?
i using visual studio 2013.
you can use time function localtime function.
example code:
//#include <time.h> time_t rawtime; struct tm * timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); //the years since 1900 according documentation, add 1900 actual year result. printf("date: %d/%d/%d time: %d:%d:%d",timeinfo->tm_year + 1900, timeinfo->tm_mon, timeinfo->tm_mday, timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
Comments
Post a Comment