473,503 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do you get a previous date in C++?

29 New Member
If you have the current date, how do you get the date 1 day or 2 days or 100 days back?
Oct 24 '10 #1
2 3458
weaknessforcats
9,208 Recognized Expert Moderator Expert
You use Julian days.

Pick a start date, like 1/1/2000 and calculate the number of days from then to your date. That will be the Julian day.

Then just subtract 100 days aand convert that result Julian date back to a calendar date.
Oct 24 '10 #2
donbock
2,426 Recognized Expert Top Contributor
Take a look at mktime (in time.h).
Oct 24 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2304
by: techie | last post by:
I am using the following to delete the contents of a cookie Response.Cookies("maincookie").expires = DateAdd("d",-2,now) Response.redirect "login.asp" If i try to alert the value of the cookie...
4
6277
by: Joe User | last post by:
Hi all....I have a feeling this is going to be one of those twisted query questions, but here it goes anyways.... I want to generate a report that shows the chronology of events (represented by...
6
1743
by: Mark | last post by:
I'm looking for how to set up a query to return the record with the previous date to the most recent date. Example: ReturnDate: 11/15/03 12/12/03 2/4/04 4/5/04 The most recent date is...
1
2742
by: Riaan | last post by:
Hi There, I am a newby with SQL and I am trying to run a query on a date/time field. The query is for the previous date. I would like to create this as a criteria in a view, but not sure what the...
2
1484
by: Amanda | last post by:
This is hotel reservation when a departure date is changed manually by user input ( to a valid date in date format - validity is checkedsomewhere else), the arrival date is set to the previous date...
0
1419
by: oracle_corrgi | last post by:
hi i have stored the date data in varchar2(30) in column name expected_date order_date in proj table 1. i want to get the nearest date of current (next) for expected_date 2. i want to get the...
2
2332
by: favor08 | last post by:
7/19/2007 12:46:30 am. is in a field called CmplteDte. It is a date stamp of when the user completed the item. I need the time for a report but for a form that the supervisors use to QA the previous...
2
8292
by: sudhaMurugesan | last post by:
Hi, I need to find the previous date from a given date in java script. Is there any code for it.Can anyone tell me.Thanks in advance
2
4149
by: DThreadgill | last post by:
Not sure how to begin with this one. My table consists of: Branch# (number, double) EntryDate (datetime, mm/dd/yyyy hh:mm:ss am/pm) One branch can have many entry dates (i.e, Branch # 76...
2
10207
by: harshakusam | last post by:
Hi All, Could someone pls let me know how to get preiousday for the current date. Y i require this because i my script runs it will genate reports and sent them via mail, and in subject to...
0
7205
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
7093
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
7287
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
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5021
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...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.