0

so i want to format a user entered date (for example "10/12/2003" or "10-12-2003") and turn it into December 10 2003, I already know how to use strftime() and have built this program

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

using namespace std;

int Fdate(string date){

  time_t rawtime;
  struct tm * timeinfo;
  char buffer [80];

  time (&rawtime);
  timeinfo = localtime (&rawtime);

  strftime (buffer,80,"Today is %B %d, %Y.",timeinfo);
  puts (buffer);

  return 0;
}


int main(){
  string date = "10/12/2003";
  Fdate(date);
}

so now I want the date that is being formatted to be entered by the user, any ideas??

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190

0 Answers0