473,776 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateSerial Method - Date.ToOADate Method

I am having issues with the "Date.ToOAD ate" method in
VB .NET. I understand that in VB6 the function DateSerial
gives an internal representation of the date.

When I use the DateSerial method in VB .Net, dragging the
mouse over to the statement, VB .NET reports the following
"Conversion from 'Date' to "Double' requires calling
the 'Date.ToOAdate' method.

When I tyoe this method in, the syntax checker undelines
the method and will not compile. The
method 'Date.FromOADat e' works.

Can someone please shed some light.

Nov 20 '05 #1
1 15299
Kenny,
What are you attempting to do?

DateSerial is used to return a Date value in both VB6 & VB.NET, not the
internal representation of a date.

In both VB6 & VB.NET you would use DateSerial like this:

Dim d As Date
d = DateSerial(2003 , 12, 1)

Remember that in VB.NET that the internal representation of a date has
changed from the VB6 internal representation of a date. VB6 (COM) defined a
date based on a Double, VB.NET (.NET) defines it based on an Long (64 bit
integer).

Hence the need to call Date.ToOADate.

Dim d As Date
Dim f as Double
d = DateSerial(2003 , 12, 1)

f = d.ToOADate()

d = Date.FromOADate (f)

Hope this helps
Jay

"Kenny" <an*******@disc ussions.microso ft.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
I am having issues with the "Date.ToOAD ate" method in
VB .NET. I understand that in VB6 the function DateSerial
gives an internal representation of the date.

When I use the DateSerial method in VB .Net, dragging the
mouse over to the statement, VB .NET reports the following
"Conversion from 'Date' to "Double' requires calling
the 'Date.ToOAdate' method.

When I tyoe this method in, the syntax checker undelines
the method and will not compile. The
method 'Date.FromOADat e' works.

Can someone please shed some light.

Nov 20 '05 #2

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

Similar topics

3
2586
by: ralph_noble | last post by:
Greetings ... I have a table named Harms and Steven with a field named inspector (text) and inspection date (date/time). I need to count up how many times the inspector appears for any inspections occured in 2004. Here's what I have, but it's giving me problems ... what am I doing wrong? Thanks.
8
4715
by: Tim | last post by:
Does anyone know how to convert a date to the hundred year date format. For example, how would i convert 8/11/2004 to its hundred year date format. Thanks! Tim
11
10420
by: tohear | last post by:
ToOADate and FromOADate don't handle negative dates with time parts correctly. Negative dates with no time parts are OK. (Note: In COM date "zero" is 12/30/1899). Does anyone know if these are known bugs and if they will be corrected? In the meantime I strongly recommend writing your own functions if you work with negative time. In particular if you've converted a vb6 project to dotnet. -----------------------
2
1918
by: Robin Tucker | last post by:
I have an active-X control (ATl/C++) that expects a date as Variant Time (a double). How can I convert a date in VB.NET into such a double? Any help would be much appreciated. thanks.
5
3208
by: jerry.ranch | last post by:
I see that DateSerial can be used to "concatenate", in a way, three fields DateSerial(year, month day) into a date field (if year , month and date are numeric values). Unfortunately, my Month field is Text (January, February etc). What function is used to convert text month to numerical 1-12? Thanks Jerry
2
7070
by: TofuTheGreat | last post by:
I'm using "Now.ToOADate" for a record timestamp in a small database app (it's what I want to do so don't try to disuade me ;-D). Anyway. I store the value of Now.ToOADate in a string field in the database (16 character field on a SQL server to be exact). Is there a way of converting the text value from that field back into a readable date/time? For example if a date is stored in the 16 character field as the OLE Automation format...
3
2684
by: RZ15 | last post by:
Hi, I have a query that calculates the sum of branch transfers for the current quarter. Here is my Quarter-to-Date field: QTD-In: Sum(CCur(IIf(="TRN" And Between DateSerial(Year(Date()),Int((Month(Date())-1)/3)*3+1,1) And DateSerial(Year(Date()),Int((Month(Date())-1)/3)*3+4,0),*!,0))) Now, I need to make sure I understand the DateSerials, which I think I do but I'd rather be safe than sorry. For DateSerial(Year(Date()),...
3
5808
by: ringer | last post by:
On a form I have a combo where a month is entered. It shows the month names in column one, but it is bound to column two where each month's corresponding number is, ie Jan=1, Feb=2, etc. So selecting April returns 4. Also on the form I have a text box where a number is entered and used as the date of the month in the aforementioned combo box. I pull those numbers (month number from the combo and date number from the text box) together...
1
9568
by: =?Utf-8?B?RGFwcGVyRGFuSEBub3NwYW0ubm9zcGFt?= | last post by:
Given the example below, can someone explain why TimeSpan.TotalDays gives a different result than subtracting 2 DateTime.ToOADates? I am completely stumped. Thanks in advance, Dan Example Output: start: 1/1/2007 12:00:00 AM end : 1/1/2007 1:00:00 AM
0
9628
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
10289
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
8952
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
7471
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
5367
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
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
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.