473,385 Members | 1,958 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,385 software developers and data experts.

Which date will it be 'over x days'?

I must be overlooking something since I can't find a simple way to
calculate which date it will be over, say, 9 days. I checked the
datetime, time and calendar modules, but none of them seem to have a
function to calculate the time offset.

Sep 18 '06 #1
1 1418
cyberco wrote:
I must be overlooking something since I can't find a simple way to
calculate which date it will be over, say, 9 days. I checked the
datetime, time and calendar modules, but none of them seem to have a
function to calculate the time offset.
I suppose that it depends on your thresholds for "simple" and "seem"
but datetime.timedelta() does it for me:

| >>import datetime
| >>datetime.date.today()
| datetime.date(2006, 9, 19)
| >>datetime.date.today() + datetime.timedelta(days=9)
| datetime.date(2006, 9, 28)
| >>>

http://docs.python.org/lib/datetime-timedelta.html

HTH,
John

Sep 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
17
by: Lapchien | last post by:
My table has a record called date/time - filled (not surprisingly) with a date and time. I can format the date in one query field, also the time, using format in an expression. My user wants me...
2
by: Catherine | last post by:
I have a database where in my query I need to be able to locate accounts that show a date greater than 14 days from the current date. How would I structure this to allow for all accounts that over...
4
by: Russell | last post by:
I have an assignment that I have to complete. I have to write a windows app in C#. Here is the spec: 1/ Date Comparison Build a program that will find the number of days between two dates. You...
7
by: William Stacey [MVP] | last post by:
Given a day of the month (<=31) how to calculate if that day is valid for all months up to some end date or DateTime.MaxValue? TIA -- William Stacey, MVP
36
by: MLH | last post by:
Does Date = Date + 1 mean Date Statement equals Date Function plus 1? And if the answer is Yes, how much actual time is being added to the date function in this assignment?
1
by: Wayne | last post by:
Hi all I'm trying to calculate the number of days (or workdays) between 2 given dates that do not include weekend days or public holidays (public holidays are user defined from a dbase, have a...
5
FOE2272
by: FOE2272 | last post by:
I am working on a report that will Sum the Sales (Bid Price Field) that are still Active (Bid Status Field) for the past 1 Week, 2 Weeks, 3 Weeks, 4 Weeks, 30 Days, 60 Days, 90 Days, 120...
16
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.