Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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!
Reply With Quote
  #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))
Reply With Quote
  #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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:27 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.