Skip to main content
Participant
February 8, 2010
Question

Display image based on week day

In my MSSQL db I have the following fields that are based on 'True' or 'False'

We'll call these our displayAd fields the actual field names are below:

displayAdMonday

displayAdTuesday

diplayAdWednesday

and so on through Sunday.

In my page I want the application to check which day of the week it is and display the records that have the displayAd fields set to true. I'm working in ASP / VB Script

Please help 🙂

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Participating Frequently
February 8, 2010

Use the datepart VBScript function passing it the interval type "w" for weekday:

response.write (DatePart("w",Now()))

You can finding a listing of VBScript functions everywhere. Here's one you can use for reference:

http://www.w3schools.com/vbscript/default.asp

Translate
Participant
February 9, 2010

Bregent -

I was hoping for a little more help with the actual code. I have the recordset in my page rsLeaderboard and based on the SQL query my ads are displaying according to the criteria. However, I need help with the inline code for only the ads that have the adDay fields set to true to display based on the weekday name. I know enough VBScript to tweak things but not enough to write my own. Can you help?

Thank you.

Translate
Participating Frequently
February 9, 2010

To be of further help I would need to know more about the database design and what your specific requirements are.

Translate