In this section, you will learn how to get the current time in C.
The header file <time.h> provides all date and time functions. In the given example, the time() function determines the current time in seconds and assigns it to time_t type variable t. The ctime() function converts the number of seconds to the current date and time. The printf() function then prints the current date and time.
Here is the code:
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: February 5, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles