Test if today is friday

Djblois

Registered User.
Local time
Today, 05:26
Joined
Jan 26, 2009
Messages
598
Is there a way to test if today is friday?
 
Or what he could have typed instead of being a butthead was,

If weekday(now()) = 6
 
Or what he could have typed instead of being a butthead was,

If weekday(now()) = 6

We are not rude on this forum, we all started somewhere and also have off days, but talking of being a butthead why use Now() which includes a time element when all you need is Date()?

Brian
 
Lee

and you could have been even more sensible and used a vb constant, not the number 6 (how would anyone know its 6? without looking it up)

if weekday(date) = vbfriday
 
Brian & Gemma -

Couldn't have said it better!

Best wishes - Bob
 
Or the miserable old goat could have answered the question in the first place instead of telling the guy to check Help for the Weekday function.

We all code in different ways. Personally I never use the Date() function because it doesn't perform the same function in other languages and it gets confusing. I just prefer NOW().
 
but why carry on being rude - brian has posted over 5000 helpful hints in the last 5 years to the many users on this forum, and the idea is that pointing people in a helpful direction is often a better solution than doing it for them.

after all the use of all the date and time functions in access is not obvious at all.

eg - who would possibly have thought a command called format, could give you a calendar week number for a date - how would you have any idea such a thing was possible if someone didnt tell you.

eg - you are using now() rather than date(), as if the two are interchangeable but there are a number of issues that can arise with dates including a time element, and you have to be sure thats what you want in access if you start using now().
 
Lee, you called someone else a butthead. I firmly believe you can do so only because of your own personal experience in how to be one, something you obviously know inside out.

The style of this forum is not to give answers out on a silver platter, but to answer in an instructive way. We do not want people to depend on this forum forever. We point in various directions so that folks can learn where to look for their answers. You can expect to see a lot of "Look for topic xxxx in the help files" or "search this forum for xxxx" or "Google for xxxx" - because that shows you where to find knowledge resources and how to better use them for directed searches.

You've posted 9 times. Brian has posted 5200+. One might look at those numbers and consider that Brian is more experienced in the style of this forum than you are. Gemma has over 4000 posts. He might be considered experienced as well. Raskew has over 2000 posts. He knows the score. And you can look at my posting count if you wish.

Please don't jump on our stuff because we don't meet your expectations - at least not until you've had a chance to learn what you SHOULD expect from us.

We don't just hand out simple answers blindly because most of the experienced members are firm believers in the old Chinese proverb: "Give a man a fish and you feed him for a day. Teach him to fish and you feed him for a lifetime." We've seen the same class assignments ten thousand times on this forum. We stopped directly answering someone else's classwork a long time ago. Now we just point to the answers.

There is one more reason we don't give out too many answer freebies. You are our competition in a tightening job market. Please explain why we should make you look better than you really are if you are too obstinate to learn how to do knowledge research for yourself. If you don't catch on how to do it right, that is one less person vying for my job. (Not everyone agrees with me on this one, but hey, that's life...)
 
Lee, you called someone else a butthead. I firmly believe you can do so only because of your own personal experience in how to be one, something you obviously know inside out.

The style of this forum is not to give answers out on a silver platter, but to answer in an instructive way. We do not want people to depend on this forum forever. We point in various directions so that folks can learn where to look for their answers. You can expect to see a lot of "Look for topic xxxx in the help files" or "search this forum for xxxx" or "Google for xxxx" - because that shows you where to find knowledge resources and how to better use them for directed searches.

You've posted 9 times. Brian has posted 5200+. One might look at those numbers and consider that Brian is more experienced in the style of this forum than you are. Gemma has over 4000 posts. He might be considered experienced as well. Raskew has over 2000 posts. He knows the score. And you can look at my posting count if you wish.

Please don't jump on our stuff because we don't meet your expectations - at least not until you've had a chance to learn what you SHOULD expect from us.

We don't just hand out simple answers blindly because most of the experienced members are firm believers in the old Chinese proverb: "Give a man a fish and you feed him for a day. Teach him to fish and you feed him for a lifetime." We've seen the same class assignments ten thousand times on this forum. We stopped directly answering someone else's classwork a long time ago. Now we just point to the answers.

There is one more reason we don't give out too many answer freebies. You are our competition in a tightening job market. Please explain why we should make you look better than you really are if you are too obstinate to learn how to do knowledge research for yourself. If you don't catch on how to do it right, that is one less person vying for my job. (Not everyone agrees with me on this one, but hey, that's life...)

AMEN! Great post!
 
Or the miserable old goat could have answered the question in the first place instead of telling the guy to check Help for the Weekday function.

We all code in different ways. Personally I never use the Date() function because it doesn't perform the same function in other languages and it gets confusing. I just prefer NOW().
Still doesn't make it the best solution. In this context Date is the better function
 
Still doesn't make it the best solution. In this context Date is the better function

I agree. It really is a point of using the correct tool for the correct application. Now is meant to be used when you are concerned about time and Date is meant to be used when dealing with dates only. It can really mess things up if you use the wrong one at the wrong time. You can totally exclude a date if you use Now to compare a date because you can wind up exluding something if the time portion doesn't occur either before or after the time portion of the date you are testing.
 
Using Extreme Mathematics to Determine if Tomorrow will be a Saturday

? format(date(), "long date")
Friday, March 06, 2009

? format(date()+1, "long date")
Saturday, March 07, 2009

Yup, Sure Enough

Happy Saturday to all you Buttheads, Miserable Old Goats and Others (maybe including those esteemed contributors with < 10 posts)

Bob
 
Last edited:
Actually, I had occasion to use something like that because of a scheduler I had to write. It sometimes needed to know if today was, ... not the FIRST day of the month, but the LAST day of the month. Obviously, if tomorrow is the 1st day of next month, today is the last of this month.

Sometimes it is easier to use a simple property of a calendar rather than do something more complicated like doing a table lookup that has to account for leap years or other abominations of programming.
 
Actually, I had occasion to use something like that because of a scheduler I had to write. It sometimes needed to know if today was, ... not the FIRST day of the month, but the LAST day of the month. Obviously, if tomorrow is the 1st day of next month, today is the last of this month.

Sometimes it is easier to use a simple property of a calendar rather than do something more complicated like doing a table lookup that has to account for leap years or other abominations of programming.
Alternatively you can use
Code:
If Date()=Dateserial(Year(date()),Month(date)+1,0) then 
  Msgbox("Today is last day of month")
End If
 

Users who are viewing this thread

Back
Top Bottom