473,405 Members | 2,373 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,405 software developers and data experts.

Day(date)

Hi All,

I am fairly new to VB .Net 2003. I have been reading a book and doing some
of the exercises. I was practicing with labels and it was explaing how to
have info show in the label, so I was experimenting with some of the other
fuctions they show like month, time etc. In the Form Load Event I could get
like Label1.Text = Month(Now) it would return a 9 or i could get the current
time to display. The book also reference Day(date) and it would return a
1-31 based on the day. But when ever I try to put Label1.text = Day(now) it
gives me an error saying Day is not valid. So I guess I am confused whe the
others would work but not Day. I can put this same expression in an access
form and it works just fine.
Can some tell me why it does not work in VB.Net?

Thanks for the Help.

Jeff
Nov 21 '05 #1
5 2314
On Wed, 21 Sep 2005 12:41:50 -0500, "Jeff" <je*****@yahoo.com> wrote:

¤ Hi All,
¤
¤ I am fairly new to VB .Net 2003. I have been reading a book and doing some
¤ of the exercises. I was practicing with labels and it was explaing how to
¤ have info show in the label, so I was experimenting with some of the other
¤ fuctions they show like month, time etc. In the Form Load Event I could get
¤ like Label1.Text = Month(Now) it would return a 9 or i could get the current
¤ time to display. The book also reference Day(date) and it would return a
¤ 1-31 based on the day. But when ever I try to put Label1.text = Day(now) it
¤ gives me an error saying Day is not valid. So I guess I am confused whe the
¤ others would work but not Day. I can put this same expression in an access
¤ form and it works just fine.
¤ Can some tell me why it does not work in VB.Net?

I would fully qualify the function with its namespace (or use Imports):

Microsoft.VisualBasic.DateAndTime.Day
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 21 '05 #2

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:jr********************************@4ax.com...
On Wed, 21 Sep 2005 12:41:50 -0500, "Jeff" <je*****@yahoo.com> wrote:

¤ Hi All,
¤
¤ I am fairly new to VB .Net 2003. I have been reading a book and doing
some
¤ of the exercises. I was practicing with labels and it was explaing how
to
¤ have info show in the label, so I was experimenting with some of the
other
¤ fuctions they show like month, time etc. In the Form Load Event I could
get
¤ like Label1.Text = Month(Now) it would return a 9 or i could get the
current
¤ time to display. The book also reference Day(date) and it would return
a
¤ 1-31 based on the day. But when ever I try to put Label1.text =
Day(now) it
¤ gives me an error saying Day is not valid. So I guess I am confused whe
the
¤ others would work but not Day. I can put this same expression in an
access
¤ form and it works just fine.
¤ Can some tell me why it does not work in VB.Net?

I would fully qualify the function with its namespace (or use Imports):

Microsoft.VisualBasic.DateAndTime.Day
Paul
~~~~
Microsoft MVP (Visual Basic)


Paul,

So does this mean that I would type the statement like:

Label1.Text = Microsoft.VisualBasic.DateAndTime.Day(Now)

or replace (Now) with like a hard coded date (09/21/2005).

Thanks,

Jeff
Nov 21 '05 #3
Label1.Text = DateTime.Now.Day

"Jeff" <je*****@yahoo.com> wrote in message
news:43**********@newspeer2.tds.net...
Hi All,

I am fairly new to VB .Net 2003. I have been reading a book and doing
some of the exercises. I was practicing with labels and it was explaing
how to have info show in the label, so I was experimenting with some of
the other fuctions they show like month, time etc. In the Form Load Event
I could get like Label1.Text = Month(Now) it would return a 9 or i could
get the current time to display. The book also reference Day(date) and it
would return a 1-31 based on the day. But when ever I try to put
Label1.text = Day(now) it gives me an error saying Day is not valid. So I
guess I am confused whe the others would work but not Day. I can put this
same expression in an access form and it works just fine.
Can some tell me why it does not work in VB.Net?

Thanks for the Help.

Jeff

Nov 21 '05 #4
On Wed, 21 Sep 2005 14:14:19 -0500, "Jeff" <je*****@yahoo.com> wrote:

¤
¤ "Paul Clement" <Us***********************@swspectrum.com> wrote in message
¤ news:jr********************************@4ax.com...
¤ > On Wed, 21 Sep 2005 12:41:50 -0500, "Jeff" <je*****@yahoo.com> wrote:
¤ >
¤ > ¤ Hi All,
¤ > ¤
¤ > ¤ I am fairly new to VB .Net 2003. I have been reading a book and doing
¤ > some
¤ > ¤ of the exercises. I was practicing with labels and it was explaing how
¤ > to
¤ > ¤ have info show in the label, so I was experimenting with some of the
¤ > other
¤ > ¤ fuctions they show like month, time etc. In the Form Load Event I could
¤ > get
¤ > ¤ like Label1.Text = Month(Now) it would return a 9 or i could get the
¤ > current
¤ > ¤ time to display. The book also reference Day(date) and it would return
¤ > a
¤ > ¤ 1-31 based on the day. But when ever I try to put Label1.text =
¤ > Day(now) it
¤ > ¤ gives me an error saying Day is not valid. So I guess I am confused whe
¤ > the
¤ > ¤ others would work but not Day. I can put this same expression in an
¤ > access
¤ > ¤ form and it works just fine.
¤ > ¤ Can some tell me why it does not work in VB.Net?
¤ >
¤ > I would fully qualify the function with its namespace (or use Imports):
¤ >
¤ > Microsoft.VisualBasic.DateAndTime.Day
¤ >
¤ >
¤ > Paul
¤ > ~~~~
¤ > Microsoft MVP (Visual Basic)
¤
¤ Paul,
¤
¤ So does this mean that I would type the statement like:
¤
¤ Label1.Text = Microsoft.VisualBasic.DateAndTime.Day(Now)
¤
¤ or replace (Now) with like a hard coded date (09/21/2005).
¤

You can use Now or anything else that will convert to a Date, that would include a hard-coded date.

You can also do the following:

'at the top of the module
Imports Microsoft.VisualBasic.DateAndTime

'in your procedure
Label1.Text = Day(Now)
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 21 '05 #5

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:v2********************************@4ax.com...
On Wed, 21 Sep 2005 14:14:19 -0500, "Jeff" <je*****@yahoo.com> wrote:

¤
¤ "Paul Clement" <Us***********************@swspectrum.com> wrote in
message
¤ news:jr********************************@4ax.com...
¤ > On Wed, 21 Sep 2005 12:41:50 -0500, "Jeff" <je*****@yahoo.com> wrote:
¤ >
¤ > ¤ Hi All,
¤ > ¤
¤ > ¤ I am fairly new to VB .Net 2003. I have been reading a book and
doing
¤ > some
¤ > ¤ of the exercises. I was practicing with labels and it was explaing
how
¤ > to
¤ > ¤ have info show in the label, so I was experimenting with some of the
¤ > other
¤ > ¤ fuctions they show like month, time etc. In the Form Load Event I
could
¤ > get
¤ > ¤ like Label1.Text = Month(Now) it would return a 9 or i could get the
¤ > current
¤ > ¤ time to display. The book also reference Day(date) and it would
return
¤ > a
¤ > ¤ 1-31 based on the day. But when ever I try to put Label1.text =
¤ > Day(now) it
¤ > ¤ gives me an error saying Day is not valid. So I guess I am confused
whe
¤ > the
¤ > ¤ others would work but not Day. I can put this same expression in an
¤ > access
¤ > ¤ form and it works just fine.
¤ > ¤ Can some tell me why it does not work in VB.Net?
¤ >
¤ > I would fully qualify the function with its namespace (or use
Imports):
¤ >
¤ > Microsoft.VisualBasic.DateAndTime.Day
¤ >
¤ >
¤ > Paul
¤ > ~~~~
¤ > Microsoft MVP (Visual Basic)
¤
¤ Paul,
¤
¤ So does this mean that I would type the statement like:
¤
¤ Label1.Text = Microsoft.VisualBasic.DateAndTime.Day(Now)
¤
¤ or replace (Now) with like a hard coded date (09/21/2005).
¤

You can use Now or anything else that will convert to a Date, that would
include a hard-coded date.

You can also do the following:

'at the top of the module
Imports Microsoft.VisualBasic.DateAndTime

'in your procedure
Label1.Text = Day(Now)
Paul
~~~~
Microsoft MVP (Visual Basic)


Ok Gotcha,

Thanks for the help.

Jeff
Nov 21 '05 #6

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

Similar topics

3
by: Keith | last post by:
I don't know javascript and was wondering if someone might give me a simple script to dynamically display the day and date in the following format: Sunday, October 12, 2003 Any help would be...
1
by: Dos Lil | last post by:
I am trying to display the day of date entered by the user.I know I need to use day(date)function.I am trying to write this in the lostfocus event of the field Workdate Can anyone please help ...
2
by: Dan Kean | last post by:
trying to display just the day of the date of the month eg. 15th can't work out the syntax - can anyone help? Thanx in Adv Dan
3
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn...
2
by: LadySugar | last post by:
Greetings! I have a database in access that contains information about the date members joined the company. Every year, membership must be renewed for each member. Usually I will send out a...
10
by: Jes | last post by:
Dear all I have a date field on a HTML form where the user is asked to key in dd/mm/yyyy However, when that is written to MySql it is either not accepted or another value is tored in the...
3
by: Reg143 | last post by:
Hi all, The code below loops from a starting date, incrementing the date and displaying date and day-of-week. Everything is fine until 2007-11-04 is reached. Any help would be appreciated. ...
1
by: user1980 | last post by:
Hello there Can somebody help me with this. I have a form where the user enters his date of birth from 2 drop downs and a textbox. Month and date are dropdowns and year is to be entered in a text...
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: 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:
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
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.