You are here:

C++/how to get system date



can u teach me the easiest way on how to get the system date? Is there a predefined function to perform this function?

I need the date to calculate the days elapsed to award interest for customers in a bank account system. This is my college assignment. Your help would be greatly appreciated. Thanks.

I am using Dev C++ compiler

Hello Nick, thank you for the question.

Sure, there is a predefined function to do this for you. It is called time() and is located in <time.h>. It takes a structure called a time_t as a parameter by pointer and fills it out with the system time. It does it kind of weird though, so I suggest you read the MSDN documentation on it, which can be found here:

There is also a function called localtime() which can convert timezones for you. I hope this answers your question.

I hope this information was helpful.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2017 All rights reserved.