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

D

drakkofox

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..
 
I

Ian Collins

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.
 
R

red floyd

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-lite/how-to-post.html#faq-5.2 and
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.8

But here's a hint. There are more than 36000 seconds in a day.
 
J

JeZu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top