469,635 Members | 1,931 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,635 developers. It's quick & easy.

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

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

Mar 22 '07 #1
3 2381
dr*******@gmail.com wrote:
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.
Mar 22 '07 #2
dr*******@gmail.com wrote:
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.
Mar 22 '07 #3
On Mar 22, 10:11 pm, drakko...@gmail.com wrote:
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
Mar 24 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by learner | last post: by
9 posts views Thread by Stefan Bauer | last post: by
8 posts views Thread by Tim::.. | last post: by
7 posts views Thread by deepagulati | last post: by
7 posts views Thread by zeyais | last post: by
33 posts views Thread by dembla | last post: by
1 post views Thread by alok sengar | last post: by
17 posts views Thread by Saps | last post: by
3 posts views Thread by N. Spiker | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.