Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


current Time ?

This topic is 5961 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


#include <stdio.h>
#include <time.h>

int main()
time_t ttime;
tm* pCurTime;
char cTimeString[32];

//Get the current time

pCurTime = localtime(&ttime);
strftime(cTimeString, 32, "%m/%d/%Y at %H:%M:%S",pCurTime);

printf("The date and time are: %s", cTimeString);
return 0;

This outputs a time in the format "03/23/2002 at 12:31:44"

voila the current time and date. To learn more about the formatting of the string, look up strftime().


Those who dance are considered insane by those who cannot hear the music.

[edited by - terminate on March 23, 2002 4:59:03 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!