Print current date and time in a file
Posted on 2004-04-16
My C program printing data in a file. Now, I need to add current date and time in a specific format. How would I do it? Is there any library function for that?
Here is what I print in a file:
Now, I need to add current date and time in yymmdd hh:mm format.
fprintf(outfile,"namedatetime=michelle date time\n");
So, it should print in a file like this (current date & time)
namedatetime=michelle 040416 10:47
Name (michelle) is constant, so don't need to worry about it. I will put michelle in print statement .
I will be really appreciated if you can help me in this.