Jump to content
Macro Express Forums

Finding the first day of the week?


hpram99

Recommended Posts

I'm drawing a blank, what would be the best method for finding the Day and Month of the first day (Saturday) of the current week (regardless of what day of the week it really is)

 

A big issue is what about today? July 1st

Start of the week is June 29th... how do we get the correct month AND day?

 

I'd imagine it would be something along the lines of

 

get month

get day

 

something to find out what day of the week it is (perhaps using some sort of divisor of 356?)

 

if difference of day and startingday < 0

then month = month - 1

 

something to find how many days in last month

subtract difference from days to get correct date.

 

 

help!

Link to comment
Share on other sites

Under Text, there is a Date command that allows you to put today's day name into a text variable.

 

The same Date command allows you to set DD (day of the month) back x number of days from today's date. Unfortunately when setting DD into the past, the command does not accept a variable so you will have to use a CASE or a series of IFs to do the setback.

 

So first, Save Day Of Week 2 (format MON, TUE, etc.) into T1

 

Then,

If T1 = "MON"

Save DD into T2 (with 1 day setback into the past)

End If

If T1 = "TUE"

Save DD into T2 (with 2 day setback into the past)

End If

If T1 = "WED"

Save DD into T2 (with 3 day setback into the past)

End If

 

etc. Copy and paste below.

 

<Day of Week 2{NP000}{P000}01><IFVAR2:1:01:1:MON><DD{NP001}{P000}02><ENDIF><IFVAR2:1:01:1:TUE><DD{NP002}{P000}02><ENDIF><IFVAR2:1:01:1:WED><DD{NP003}{P000}02><ENDIF><TBOX4:T:1:CenterCenter000278000200:000:Day%T2%>

Link to comment
Share on other sites

Under Text, there is a Date command that allows you to put today's day name into a text variable.

 

The same Date command allows you to set DD (day of the month) back x number of days from today's date. Unfortunately when setting DD into the past, the command does not accept a variable so you will have to use a CASE or a series of IFs to do the setback.

 

So first, Save Day Of Week 2 (format MON, TUE, etc.) into T1

 

Then,

If T1 = "MON"

Save DD into T2 (with 1 day setback into the past)

End If

If T1 = "TUE"

Save DD into T2 (with 2 day setback into the past)

End If

If T1 = "WED"

Save DD into T2 (with 3 day setback into the past)

End If

 

etc. Copy and paste below.

 

<Day of Week 2{NP000}{P000}01><IFVAR2:1:01:1:MON><DD{NP001}{P000}02><ENDIF><IFVAR2:1:01:1:TUE><DD{NP002}{P000}02><ENDIF><IFVAR2:1:01:1:WED><DD{NP003}{P000}02><ENDIF><TBOX4:T:1:CenterCenter000278000200:000:Day%T2%>

 

Holy moly!

I'm finding more and more I need to write K.I.S.S. all over my cubicle walls.

 

Thanks a bunch!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...