473,672 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need to divide a date

Hey there,
i am doing a plotting application.
i am using mxRelativeDateT imeDiff 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 1937
ne*****@xit.net wrote:
Hey there,
i am doing a plotting application.
i am using mxRelativeDateT imeDiff 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\Projec ts\Python>pytho n
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(200 5, 1, 1)
d2 = dt.DateTime(200 5, 1, 21)
rdt = dt.RelativeDate TimeDiff(d2, d1)
rdt <RelativeDateTi me instance for 'YYYY-MM-(+20) HH:MM:SS' at 0x9f1300> rdt/20 <RelativeDateTi me instance for 'YYYY-MM-(+01) HH:MM:SS' at 0x9d5e90> for i in range(20): .... print dt.DateTime(200 0) + i*(rdt/20)
....
C:\Python24\lib \site-packages\mx\Dat eTime\DateTime. py:585:
DeprecationWarn ing: 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
1569
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> <sql:date>YYYYMMMDD</sql:date>
6
12519
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 and addition / subtraction instead (doing this saved me about 11% time on my 2.26ghz P4). Really easy with powers of two. I implemented this last night when I was tired, and this morning, I realize it was not exactly right (values were slightly...
5
4234
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 some kind of IF statement without writing it all out. The problem is either total cost or conversions will have some zeros in the table. SUM(/) Any help would be appreciated - Happy New Year
21
1318
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 be date/hour/minute/second all as one integer? Thanks, Trint .Net programmer trintsmith@hotmail.com
10
6276
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) and have it calculate the payment amount for 3 mortgage loans: a.. 7 year at 5.35% b.. 15 year at 5.5% c.. 30 year at 5.75% Use an array for the different loans. Display the mortgage payment amount
3
5255
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 junitreport. I created a simple Math.java class which contains: package test; public class Math { public int add(int a, int b) { return a + b; }
40
3632
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 int) ? Same question for the corresponding unsigned types.
7
5331
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 date System.out.println(string_dob); s.Info_DOB=Date.valueOf(string_dob); runs perfectly fine in the method insert() and throws up an illegal Exception in the method UPDATE.This is the error I get when I pass a date "1979-05-02"
10
2106
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 #these are the operations + = , - = , * = , 1/ = only if 0 not in .
0
8498
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
8418
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,...
1
8630
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8694
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7458
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...
0
4237
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...
1
2833
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2084
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1831
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.