473,657 Members | 2,654 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 3477
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
2318
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 in the same page, it shows the old value. As well as when it is alerted from the login.asp it shows the old value. The problem is when i try to update the value of the cookie in the login page, it does not update the new value.
4
6285
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 field names). Essentially, I would like to sort the DATE FIELDS for each record in the table by the order of the DATES in those DATE FIELDS. For example: record ID= 354
6
1752
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 4/5/04. I need to return the record with 2/4/04.
1
2752
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 criteria should look like doing a previous day query. The test query I have done using SQL analyzer is (select * from mvs_store_all_data_time_change where mvs_creation_date like '060801%'). This returns the previous days data, but is hard...
2
1495
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 upon MouseLeave. How do I calculate the date of the previous day (see mdatArrivalDate = ???? )? (I have already done calculating departure date when an arrrivalDate is modified manually - not via selecting on calendar - to valid data by...
0
1424
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 nearest date of current (previous) for ordered_date think today is 05-april-2007 i want for next =06-april-2007 and for previous i want 04-april-2007 thanxs a lot in advance
2
2342
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 days work I format the date to 7/19/2007 using a query Format(,"mm/dd/yy") so that they see everything for that date and not just that time. My questions is that when work is stamped after 12 midnight it date stamps to the next day, How do I...
2
8314
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
4163
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 has 10 entry dates). I'm trying to show the most recent entry date & the previous entry date on a report. I know how to get the most recent entry date using Max. How would I get to the previous entry date? (Current is 2/14/2008 2:26:07 PM and...
2
10217
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 include date. And the problem is when these reports failed if we run these reports next day the subect line will current day actually we are ruuning reports for previous day. Could some one pls help me out from this...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4152
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.