c++ other date format?

1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <ctime>

int main ()
{
  char date [10];
  _strdate(date);
  std::cout<<"Current Date:"<<date;
  return 0;
}


I use these to print out date but I don't want the output be mm/dd/yy, it look confusing..

I prefer dd/mm/yyyy or dd-mm-yyyy, how?
Use the following reference. strftime has greater control to format date string. It allows you to specify different delimiter.

http://www.cplusplus.com/reference/clibrary/ctime/strftime/
Last edited on
Topic archived. No new replies allowed.