Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date functions

Status
Not open for further replies.

herci

Programmer
Nov 8, 2002
23
0
0
PA
Hi!
Is there any date function in visual basic that I can use to identify the day of the week giving a date ...
for example:

I introduce 08/05/02 or August 05, 2002
and the function returns Monday .. or the number of the day in the week (2)..

How can I do this?

I will appreciate any kind of information
thanks
 
You can use the datepart() function with "w" as the day of week interval:

datepart("w", now())

 
Hi,

Code:
din nDay as integer
nDay = Weekday("25/12/02")

nday will take values from vbSunday (1) to vbSaturday (7).

If you want to cahnge the first day of the week, supple the appropriate value as the second parameter of the fucntion call

Hope this is what you want
Matt
 
Try this

Format(date,"dddd")
will give you Monday etc

Format(date,"ddd")
will give you Mon etc

Let me know if this helps

If you are worried about posting, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
thanks both!
I will try the two the functions...

Thanks again..!
 
Also bear the WeekdayName() function in mind, which returns the actual day name string.

Make sure you've got the FirstDayOfWeek parameter set properly though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top