473,412 Members | 4,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 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 2535
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 window which is to be opened on clicking one link...
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 (for days) and MMYYYY (for months). The target...
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 1000 1000 1 0 1002 ...
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 runs from a central webserver??? Thanks for...
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 any way that we can deselect that value. I...
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} </style> <body> <div class="leftcolumn"...
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 7 8 9 in sorted form
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 UDP type Socket and recieving packet from this...
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 browser. Meaning i have a page with a list of all...
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 packet has the urgent flag set, the text read from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.