How to show monday of this week on a form 
Author Message
 How to show monday of this week on a form

I am new at ASP. I had to add a date format to a form that employees print
out any day of the week. It always has to show the Monday and Friday of the
current workweek whether the form is printed Monday, Sunday, Thursday, etc.

I did this below and so far it works fine but I am not sure why.

<%
Dim KcmDate, MonDay, FriDay
KcmDate = CDate(FormatDateTime(Now,2))
MonDay = KcmDate + 1 - (WeekDay(KcmDate, vbMonday))
Friday = MonDay + 4
%>

For the week of Monday <%Response.Write (MonDay) & " - Friday " & (Friday)%>

Any other simpler ideas to do the same thing?

ken miller



Mon, 21 Jul 2003 13:18:51 GMT  
 How to show monday of this week on a form
Ken,

   What you've done looks pretty good.  The only thing I would change
is the display line.  You can write it so that it's easier to
understand if you code it like this:

For the week of Monday <%= MonDay%> - Friday <%= FriDay%>

Don't forget the "=" just after the ASP brackets--they're required.
You can use this syntax when you just want to insert the value of an
ASP variable.

Terry



Quote:
> I am new at ASP. I had to add a date format to a form that employees
print
> out any day of the week. It always has to show the Monday and Friday
of the
> current workweek whether the form is printed Monday, Sunday,
Thursday, etc.

> I did this below and so far it works fine but I am not sure why.

> <%
> Dim KcmDate, MonDay, FriDay
> KcmDate = CDate(FormatDateTime(Now,2))
> MonDay = KcmDate + 1 - (WeekDay(KcmDate, vbMonday))
> Friday = MonDay + 4
> %>

> For the week of Monday <%Response.Write (MonDay) & " - Friday " &
(Friday)%>

> Any other simpler ideas to do the same thing?

> ken miller

Sent via Deja.com
http://www.deja.com/


Tue, 22 Jul 2003 01:26:03 GMT  
 How to show monday of this week on a form
Thanks for your advice. I will do.

ken


Quote:
> Ken,

>    What you've done looks pretty good.  The only thing I would change
> is the display line.  You can write it so that it's easier to
> understand if you code it like this:

> For the week of Monday <%= MonDay%> - Friday <%= FriDay%>

> Don't forget the "=" just after the ASP brackets--they're required.
> You can use this syntax when you just want to insert the value of an
> ASP variable.

> Terry



> > I am new at ASP. I had to add a date format to a form that employees
> print
> > out any day of the week. It always has to show the Monday and Friday
> of the
> > current workweek whether the form is printed Monday, Sunday,
> Thursday, etc.

> > I did this below and so far it works fine but I am not sure why.

> > <%
> > Dim KcmDate, MonDay, FriDay
> > KcmDate = CDate(FormatDateTime(Now,2))
> > MonDay = KcmDate + 1 - (WeekDay(KcmDate, vbMonday))
> > Friday = MonDay + 4
> > %>

> > For the week of Monday <%Response.Write (MonDay) & " - Friday " &
> (Friday)%>

> > Any other simpler ideas to do the same thing?

> > ken miller

> Sent via Deja.com
> http://www.deja.com/



Thu, 24 Jul 2003 00:07:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. every day show Monday and Friday of the week on a form

2. Showing Monday to Friday Week

3. Date of Monday actual week

4. How to get this week's Monday date

5. Wrong week number for last monday

6. Code to show week using calendar ctl!

7. Calendar ctl and showing weeks!

8. How to show toolbar before form is shown

9. visible=true/Form.Show makes Form.Location change!

10. My Form doesn't show in front of the calling Form

11. exception on form.show (vb.Net windows forms)

12. Why does it close the form if I call the show method of the form

 

 
Powered by phpBB® Forum Software