ok so i read the function help on this site and found out how to get the date now all i want is to be able to compare the date to another varible so i would like to be able to change the date into a number...
ok so i read the function help on this site and found out how to get the date now all i want is to be able to compare the date to another varible so i would like to be able to change the date into a number...
read each part of the date into an int
so you have
d=21
m=01
y=2001
then cast them to strings and join them up tom become one string
dmy [8] ="21012001"
Monday - what a way to spend a seventh of your life
If you're comparing dates against other dates, it is probably easier to reverse them -
yyyymmdd
20020121
That way you can tell with one comparison if one date is before or after another.
ok so now how do i change hold_time into this format yyyymmdd
Code:#include <time.h> #include <iostream.h> int main() { time_t hold_time; hold_time=time(NULL); cout<<hold_time; cout<<time; return 0; }