![]() |
|
#1
|
|||
|
|||
Time Problem in ProgramHey I'm Workin on a program that calculates age. My Problem is that I need to access the computer time and somehow compare it to the birthdate input. I tryed to use ctime, but it doesnt work the way i need it to.
ex: the user inputs a b-date: 08/23/1943 the program has to calculate the date using the computers time. ctime gives me Wed Oct 29 21:03:27 2003. is there a way to convert 08/23/1943 to the ctime format? or the opposite? if anyone can help me that would be greatly appriciated. MrSmiley p.s. im not asking for the program i am making it, i just need help on using the computers time |
|
#2
|
|||
|
|||
|
ctime will give you what you need. Internally it has a "tm" structure which splits up the string into the chunks you expect, seconds, mins, etc...
Exerpt from /usr/include/time.h CPP / C++ / C Code:
The time() functino return the number of seconds since 00:00 Jan 1, 1970. Then the localtime() function does math on this number to work fill in the values into the tm structure above. Here's an example: CPP / C++ / C Code:
Good link: www-ccs.ucsd.edu. GF |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error during program | rjd72285 | C++ Forum | 0 | 11-Nov-2003 18:49 |
| Display Size and maybe download time | BobbyDouglas | MySQL / PHP Forum | 5 | 08-Nov-2003 00:18 |
| one program access another? | dgoulston | C++ Forum | 1 | 07-Oct-2003 11:26 |
| ambiguity in time field | zuzupus | MySQL / PHP Forum | 9 | 28-Jul-2003 08:40 |
| time Problem | zuzupus | MySQL / PHP Forum | 9 | 24-Jul-2003 07:02 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The