Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 19th, 2004, 07:27 AM
Registered User
 
Join Date: Jan 2004
Location: Melbourne, Victoria, Australia.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 1st Week-Day of the Month

Hi all,
This might sound like a stupid question but I have been trying to find out what is the first weekday of the current month. I have use the below code which works for January but when I change the current day by changing the server date to another month its not correct.
curDay = day(Now)
curMonth = month(Now)
curYear = year(Now)
(Weekday(cdate(curMonth&"/1/"&curYear)))

It should return to me a number from 1 to 7 (Sun to Sat)
Jan 2004 .
What am I doing wrong?
I'd appreciate any help.
Thank
Graham

Use you brain, not your brawn!
  #2 (permalink)  
Old January 19th, 2004, 07:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Use DateSerial function to build your date - then there's no chance it will be misinterpreted:
Weekday(DateSerial(curYear, curMonth, 1))
  #3 (permalink)  
Old January 19th, 2004, 10:01 AM
Registered User
 
Join Date: Jan 2004
Location: Melbourne, Victoria, Australia.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi pgTips,
Thanks so much. It worked. I have been battling with this little problem for a couple of days.
Thanks Again

Use you brain, not your brawn!


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting the same day of the week. crabjoe Classic ASP Basics 3 February 27th, 2008 12:45 PM
DAY of the week wdepreter Excel VBA 3 February 7th, 2007 06:44 AM
Day of week finder mrjaygreene Classic ASP Basics 6 May 13th, 2006 04:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.