472,328 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 2484
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: learner | last post by:
Hi, In a page, i have many links. I have some functions in a global file which is included in all linked pages. I want to have a reference to a...
9
by: Stefan Bauer | last post by:
Hi NG, we've got a very urgent problem... :( We are importing data with the LOAD utility. The input DATE field data is in the format DDMMYYYY...
2
by: Dimitri | last post by:
PLEASE HELP,I HAVE A DATABSE WITH MULTIPLE RECORDS AS OUTLINED BELOW EMP NO LEVEL NEXTINCREASE WAGETYPE UNIT 1000 1 0 ...
8
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application...
7
by: deepagulati | last post by:
Hi, I need an urgent help from you. When we dynamically genrate any list box (Select Box) it shows one default value as selected. Is there...
7
by: zeyais | last post by:
Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc}...
33
by: dembla | last post by:
Hey Frnds can anyone help me in this i need a program in 'c' PROGRAM to print NxN Matrix 9 1 8 1 2 3 2 7 3 as 4 5 6 6 4 5 ...
1
by: alok sengar | last post by:
hi, I have already tried this URL's code "http://www.java2s.com/Code/CSharp/Network/SimpleSNMP.htm" but I am getting error when i am creating a...
17
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.