Friday, May 15, 2015

Get today date in dd/mm/yyyy

#include <time.h>

time_t now = time( &now ) ;
struct tm* local_time = new tm( ) ;
local_time = localtime( &now ) ;
char buffer[20] = { '\0' } ;
strftime( buffer, BUFSIZ, "%d/%m/%Y", local_time ) ;
delete local_time;

more details on strftime Reference

No comments:

Post a Comment