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

Test Date

In VB6 I could do something like:

If dMyDate<=2 Then

would return true if the date was not a recent date.

How can I do this in VB2005?

I've tried Cdbl(dMyDate)<=2 but I get an error message telling me I can't do
this 'cast'.

I've tried Google but can't find any examples.

Larry Rebich
Oct 7 '06 #1
3 1313
I am not sure why anyone would want to write code that was so indeterminate,
even if Visual Basic allowed it. :-)

AFAIK, there is no function available to test a date as a double.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"Larry Rebich" <lr*****@earthlink.netwrote in message
news:UH*****************@newsread1.news.pas.earthl ink.net...
In VB6 I could do something like:

If dMyDate<=2 Then

would return true if the date was not a recent date.

How can I do this in VB2005?

I've tried Cdbl(dMyDate)<=2 but I get an error message telling me I can't
do this 'cast'.

I've tried Google but can't find any examples.

Larry Rebich


Oct 7 '06 #2
Larry,

The same as in VB6 probably, I assume that the code you thinking about is
not the code that you show, I have never seen a date as a single digit

You mean probably something as
dim dMyDate as integer = MyDateComplete.DayOfWeek

if dMyDate <= 2 then

Cor

"Larry Rebich" <lr*****@earthlink.netschreef in bericht
news:UH*****************@newsread1.news.pas.earthl ink.net...
In VB6 I could do something like:

If dMyDate<=2 Then

would return true if the date was not a recent date.

How can I do this in VB2005?

I've tried Cdbl(dMyDate)<=2 but I get an error message telling me I can't
do this 'cast'.

I've tried Google but can't find any examples.

Larry Rebich


Oct 8 '06 #3
Actually in VB Date is a Double so the value 2 is a legal date as you can
verify with CDate(2) - which is 1.1.1900. So to get the same result (if you
really wish to to that - sometimes it's not very advisable to port from
legacy code to .NET 1 by 1) it would be:

if (dMyDate <= new DateTime(1900, 1, 1))

Regards

Jochen

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:eu**************@TK2MSFTNGP03.phx.gbl...
Larry,

The same as in VB6 probably, I assume that the code you thinking about is
not the code that you show, I have never seen a date as a single digit

You mean probably something as
dim dMyDate as integer = MyDateComplete.DayOfWeek

if dMyDate <= 2 then

Cor

"Larry Rebich" <lr*****@earthlink.netschreef in bericht
news:UH*****************@newsread1.news.pas.earthl ink.net...
>In VB6 I could do something like:

If dMyDate<=2 Then

would return true if the date was not a recent date.

How can I do this in VB2005?

I've tried Cdbl(dMyDate)<=2 but I get an error message telling me I can't
do this 'cast'.

I've tried Google but can't find any examples.

Larry Rebich



Oct 8 '06 #4

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

Similar topics

3
by: TANDEX | last post by:
6
by: chris yoker via DotNetMonster.com | last post by:
hiya, i have an xml doc, and I'd like to assign lookup values. Eg, if the "PRODUCT-TYPE" is 6, then I insert "bike" into the innerText. <code> <rows> <row> <PRODUCT-TYPE>6</PRODUCT-TYPE>...
7
by: Gertjan van Heijst | last post by:
Hi, I really hope someone can help me because I've already spend 2 days on this problem and I'm not getting anywhere. I think the problem is that I don't really understand how text boxes store...
1
by: Vern | last post by:
I'm using the Microsoft Enterprise Data Access block to call the stored procedure. One of the values the stored procedure returns is the stop date. When the stop date is null, the program crashes....
11
by: sara | last post by:
I am trying my first functions in my code. I have a set of queries that runs to create temp tables with the right data for some reports. They can run for a long time, so I want the user to know...
6
by: SevDer | last post by:
Is there a way to test guid string? I want to do it without try catch block to save on performance. Thanks in advance. -- SevDer
2
by: Netkiller | last post by:
#!/usr/bin/python # -*- coding: utf-8 -*- """ Project: Network News Transport Protocol Server Program Description: 基于数据库的新闻组,实现BBS前端使用NNTP协议来访问贴子...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
2
by: alice | last post by:
I'm just starting to learn php, and here's the code from a book I'm reading - The time is <?php echo date(H:i:s');?> and the date is <?php echo date(j F Y');?> I typed it in an editor called...
1
by: Paul Brady | last post by:
In a self-contained database, the following query works fine and returns courses taken on 3/8/2000: ---------- SELECT TransactionCourses.CourseID, TransactionCourses.MbrID,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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:
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
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...
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...

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.