473,465 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to create datetime object from DbiDate (win32.odbc)?

Hi all

I am using odbc from win32 extensions to connect to MS SQL Server. I
use mx.DateTime to handle dates. When I select a datetime column from
the database, odbc returns something called a DbiDate object. I cannot
find out any information on this type, but mx can convert it to a
mx.DateTime object using DateTimeFrom(), which is really all that I
need.

I am looking into changing from mx.DateTime to using the builtin
datetime type, but I cannot figure out how to convert a DbiDate object
to a datetime object.

First prize would be to have a datetime constructor that takes a
DbiDate object as input, in the same way that mx does, but this does
not seem to exist.

Second prize would be to extract the year/month/day elements from the
DbiDate object, and construct the datetime object manually. However, if
I try dir(d), where d is a DbiDate object, I get an empty list, so I
cannot even see how to extract the elements.

Does anyone know if this is possible, and if so, how?

Many thanks

Frank Millman

Jul 18 '05 #1
1 3252
Frank Millman wrote:
Hi all

I am using odbc from win32 extensions to connect to MS SQL Server. I
use mx.DateTime to handle dates. When I select a datetime column from
the database, odbc returns something called a DbiDate object. I cannot
find out any information on this type, but mx can convert it to a
mx.DateTime object using DateTimeFrom(), which is really all that I
need.

I am looking into changing from mx.DateTime to using the builtin
datetime type, but I cannot figure out how to convert a DbiDate object
to a datetime object.

First prize would be to have a datetime constructor that takes a
DbiDate object as input, in the same way that mx does, but this does
not seem to exist.

Second prize would be to extract the year/month/day elements from the
DbiDate object, and construct the datetime object manually. However, if
I try dir(d), where d is a DbiDate object, I get an empty list, so I
cannot even see how to extract the elements.

Does anyone know if this is possible, and if so, how?

Many thanks

Frank Millman

I've always used

from mx.DateTime import DateTimeFromCOMDate
t=DateTimeFromCOMDate(dbidate)

Larry Bates
Jul 18 '05 #2

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

Similar topics

0
by: Jim S. | last post by:
I'm having a horrible time simply inserting the date in a MySQL database through a Visual Basic program. I have a table, called "ORDERS"; "ID" is the primary key. I'm trying the insert the date,...
8
by: DerekS | last post by:
Hi, I've been pulling my hair out trying to write a simple method to programatically create a system DSN with all parameters on a remote machine. I have ensured I have the correct permissions on...
4
by: Roland Wolters | last post by:
Hi, I am reading data from a unix odbc datasource in a c# program. Reading the data as works fine, but one field, contains a date-time format that .net does not understand. The query would...
7
by: flupke | last post by:
I'm using a solid DB and i'm accessing it via the odbc module (activepython). I get a DbiDate object returned but i don't find a way to decently print it or get a format like %d/%m%/%y. I found...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
2
by: TBoon | last post by:
I have a vb.net program to read DATETIME column from MSSQL and write to a TXT file. And I notice that the DATETIME format in the TXT file changed according to my machine datetime setting in...
29
by: dyork | last post by:
When getting data from a database using the dbapi and an SQL query, how do you in general round trip the data? Especially date-time? An SQL datetime column translates nicely into a Python...
0
by: Greg Corradini | last post by:
Hello, Lately I've been using the mx.ODBC module to query Access (mdb) tables. For the life of me, I can't get the 'create table' sql command to work. I use this command in Oracle and I've seen...
4
by: boblatest | last post by:
Hello, I wrote aprogram that imports odbc and dbi. Originally I used PyWin, but now I prefer IDLE for working in Windows. Anyway, when I start my program from IDLE, it can't import the odbc and...
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
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
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
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...
0
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,...
0
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.