how do you set these integers...
int month, day, year;
to today's date year, month, and day.
IN C++ PLS!!
C++ help, how to set an integer to today's year, month, and day.?
#include %26lt;time.h%26gt;
#include %26lt;stdio.h%26gt;
struct tm newtime;
__time32_t aclock;
void main( void )
{
// Get time in seconds.
_time32( %26amp;aclock );
// Convert time to struct tm form.
_localtime32_s( %26amp;newtime, %26amp;aclock );
// Now you can access the newtime fields of the tm struct
// ex: newtime.tm_sec
//struct tm {
// int tm_sec; /* seconds, 0-59 */
// int tm_min; /* minutes, 0-59 */
// int tm_hour; /* hours, 0-23 */
// int tm_mday; /* day of the month, 1-31 */
// int tm_mon; /* months since Jan., 0-11 */
// int tm_year; /* years from 1990 */
// int tm_wday; /* days since Sunday, 0-6 */
// int tm_yday; /* days since Jan. 1, 0-365 */
// int tm_isdst; /* daylight saving time indicator */
//};
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment