Connecting Tech Pros Worldwide Forums | Help | Site Map

urgent help!: trying to make a seconds subtraction from a time_t

drakkofox@gmail.com
Guest
 
Posts: n/a
#1: Mar 22 '07
Hi there, i need to subtract 36000 seconds, or a day, to get the
yesterday's date, but with consistence check. for example, if i input
the date 01/03/2007(dd/mm/yyyy) on the program, it should output
28-02-2007.
or if i input 01/01/2006 it should output 31/12/2006.
example would be... program asks day, then month, then year, then it
outputs
dd-mm-yyyy with a day subtracted from it.

i need this program, because it will work with a database. it needs to
show 60 records before the inputed data. the only missing program part
is this conversion. an php equivalent would be mkdate()[A LOT
different from c++], then use date() form php also.

the program will capture the day, the month and the year. then it will
output the date in this format dd-mm-yyyy minus a day. but it needs to
do the consistence. so i think that subtracting 36000 seconds would be
more safe.(36000=day).

Thanks a lot, PLEASE HELP! my job is depending on this code..


Ian Collins
Guest
 
Posts: n/a
#2: Mar 22 '07

re: urgent help!: trying to make a seconds subtraction from a time_t


drakkofox@gmail.com wrote:
Quote:
Hi there, i need to subtract 36000 seconds, or a day, to get the
yesterday's date, but with consistence check. for example, if i input
the date 01/03/2007(dd/mm/yyyy) on the program, it should output
28-02-2007.
or if i input 01/01/2006 it should output 31/12/2006.
example would be... program asks day, then month, then year, then it
outputs
dd-mm-yyyy with a day subtracted from it.
>
man ctime.

--
Ian Collins.
red floyd
Guest
 
Posts: n/a
#3: Mar 22 '07

re: urgent help!: trying to make a seconds subtraction from a time_t


drakkofox@gmail.com wrote:
Quote:
Hi there, i need to subtract 36000 seconds, or a day, to get the
yesterday's date, but with consistence check. for example, if i input
the date 01/03/2007(dd/mm/yyyy) on the program, it should output
28-02-2007.
or if i input 01/01/2006 it should output 31/12/2006.
example would be... program asks day, then month, then year, then it
outputs
dd-mm-yyyy with a day subtracted from it.
>
i need this program, because it will work with a database. it needs to
show 60 records before the inputed data. the only missing program part
is this conversion. an php equivalent would be mkdate()[A LOT
different from c++], then use date() form php also.
>
the program will capture the day, the month and the year. then it will
output the date in this format dd-mm-yyyy minus a day. but it needs to
do the consistence. so i think that subtracting 36000 seconds would be
more safe.(36000=day).
>
Thanks a lot, PLEASE HELP! my job is depending on this code..
>
See http://www.parashift.com/c++-faq-lit...t.html#faq-5.2 and
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

But here's a hint. There are more than 36000 seconds in a day.
JeZu
Guest
 
Posts: n/a
#4: Mar 24 '07

re: urgent help!: trying to make a seconds subtraction from a time_t


On Mar 22, 10:11 pm, drakko...@gmail.com wrote:
Quote:
Hi there, i need to subtract 36000 seconds, or a day, to get the
yesterday's date, but with consistence check. for example, if i input
the date 01/03/2007(dd/mm/yyyy) on the program, it should output
28-02-2007.
or if i input 01/01/2006 it should output 31/12/2006.
example would be... program asks day, then month, then year, then it
outputs
dd-mm-yyyy with a day subtracted from it.
>
i need this program, because it will work with a database. it needs to
show 60 records before the inputed data. the only missing program part
is this conversion. an php equivalent would be mkdate()[A LOT
different from c++], then use date() form php also.
>
the program will capture the day, the month and the year. then it will
output the date in this format dd-mm-yyyy minus a day. but it needs to
do the consistence. so i think that subtracting 36000 seconds would be
more safe.(36000=day).
>
Thanks a lot, PLEASE HELP! my job is depending on this code..
use mktime, after subtract the seconds to struct tm

--
Jesús Hellín


Closed Thread