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

need to divide a date

Hey there,
i am doing a plotting application.
i am using mxRelativeDateTimeDiff to get how much time is between
date x and date y

now what i need to do is divide that time by 20 to get 20 even time
slots
for plotting on a graph.

For example, if the difference between them is 20 hours, i need 20
plots, each an hour apart. if its 40 minutes, i need 20 plots that are
2 minutes apart.

what would be a way i could pull this off?

thanks

Sep 22 '05 #1
1 1916
ne*****@xit.net wrote:
Hey there,
i am doing a plotting application.
i am using mxRelativeDateTimeDiff to get how much time is between
date x and date y

now what i need to do is divide that time by 20 to get 20 even time
slots
for plotting on a graph.

For example, if the difference between them is 20 hours, i need 20
plots, each an hour apart. if its 40 minutes, i need 20 plots that are
2 minutes apart.

what would be a way i could pull this off?

thanks

C:\Steve\Projects\Python>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
import mx.DateTime as dt
d1 = dt.DateTime(2005, 1, 1)
d2 = dt.DateTime(2005, 1, 21)
rdt = dt.RelativeDateTimeDiff(d2, d1)
rdt <RelativeDateTime instance for 'YYYY-MM-(+20) HH:MM:SS' at 0x9f1300> rdt/20 <RelativeDateTime instance for 'YYYY-MM-(+01) HH:MM:SS' at 0x9d5e90> for i in range(20): .... print dt.DateTime(2000) + i*(rdt/20)
....
C:\Python24\lib\site-packages\mx\DateTime\DateTime.py:585:
DeprecationWarning: i
nteger argument expected, got float
return DateTime(year, month, 1) + \
2000-01-01 00:00:00.00
2000-01-02 00:00:00.00
2000-01-03 00:00:00.00
2000-01-04 00:00:00.00
2000-01-05 00:00:00.00
2000-01-06 00:00:00.00
2000-01-07 00:00:00.00
2000-01-08 00:00:00.00
2000-01-09 00:00:00.00
2000-01-10 00:00:00.00
2000-01-11 00:00:00.00
2000-01-12 00:00:00.00
2000-01-13 00:00:00.00
2000-01-14 00:00:00.00
2000-01-15 00:00:00.00
2000-01-16 00:00:00.00
2000-01-17 00:00:00.00
2000-01-18 00:00:00.00
2000-01-19 00:00:00.00
2000-01-20 00:00:00.00


Does this help?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.pycon.org

Sep 22 '05 #2

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

Similar topics

0
by: Norman Barker | last post by:
Hi, I am trying to use the DVC algorithm detailed at http://www.topxml.com/code/default.asp?p=3&id=v20020107050418 had a few problems, the document is structured as : : <sql:row>...
6
by: Nobody | last post by:
I have some code that I am trying to optimize for speed... trying to squeeze every last CPU cycle out... I remembered an old trick where dividing & multiplying can be sped up by using bitshifts...
5
by: hobo | last post by:
I have this query that I would rather not turn into a stored proc. because the client really has no budget. I was hoping there would be a way to add this statement inline to the following sql with...
21
by: Trint Smith | last post by:
This will be a customer number that is automatically assigned. I want it to be fast (so that it doesn't have to be checked for existance in sql server) and impossible to ever reoccure. Could it...
10
by: pcbutts1 | last post by:
Yes this is a homework assignment. My instructor has broken english and I just could not follow along last night. How do I do this Write the program in Java (without a graphical user interface)...
3
by: knightsmastergeneral | last post by:
Hi, I'm currently working on getting junit and junireport to take some java files, convert it to xml and then display error messages / success rates etc in html which is one of the features of...
40
by: Spiros Bousbouras | last post by:
Do you have an example of an implementation where sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long...
7
helpwithcode
by: helpwithcode | last post by:
Hi people, I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements, String string_dob=text_dob.getText(); //Converting string to...
10
by: CuTe_Engineer | last post by:
hii, i have cs assignment i tried to solve it but i still have many errors , plzz help mee :"< it`s not cheating becuz i`ve tried & wrote the prog. i just wanna you to show me my mistakes ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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?
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...

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.