+ 5
How to print current date and time in c and c# language?
Its possible?
4 Respuestas
+ 5
// C version
#include<stdio.h>
#include<time.h>
int main()
{
time_t t;
time(&t);
printf("\nCurrenr time : %s", ctime(&t));
return 0;
}
https://www.google.com/amp/s/www.geeksforgeeks.org/print-system-time-c-3-different-ways/amp/
+ 5
#include <stdio.h>
#include <string.h>
int main() {
printf ("%s", __DATE__);
return 0;
}
https://www.sololearn.com/learn/C/2957/
+ 2
using C# it would be.
DateTime aDate = DateTime.Now;
Console.WriteLine(aDate.ToString("MM/dd/yyyy"));
Console.WriteLine(new DateTime(2021,01,01).ToString());
Have a look this link to find out about all format options.
https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1
https://code.sololearn.com/cILKYjJ7urw8
+ 2
Thanks ❤