Science, asked by samhitaatreya3381, 1 year ago

How to print current date and time in C/C++ ?

Answers

Answered by jindalmohit06p9jg8v
0
In order to facilitate finding the current local day, date and time, C++ has defined several functions in the header file , so functions which will help us in achieving our objective of finding local day, date and time are:

time():

It is used to find the current calendar time.
Its return type is time_t, which is an arithmetic data type capable of storing time returned by this function.
If its argument is not NULL, then it assigns its argument the same value as its return value.
localtime():



It uses the argument of time(), which has the same value as the return value of time(), to fill a structure having date and time as its components, with corresponding time in local timezone.
Similar questions