I am trying to get the system date into 3 different varibles Month,Day, and Year but I cant figure out how to get the system date from the OS.
guy40az
0
Junior Poster in Training
Recommended Answers
Jump to PostThere's a header called time.h (ctime in C++) that contains the functions and types you need. Try a google search for details, and if you have trouble with the actual implementation, feel free to ask here for help.
Jump to Post>>is this the best way to do this?
Yes, that's how all the programs I've seen does it, although there are other os-specific functions. The code you wrote is completely portable and correct.
All 6 Replies
Narue
5,707
Bad Cop
Team Colleague
guy40az
0
Junior Poster in Training
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
John A
1,896
Vampirical Lurker
Team Colleague
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
guy40az
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.