PC Review


Reply
Thread Tools Rate Thread

Any software to find relevant months from specified day and date number?

 
 
Jane D
Guest
Posts: n/a
 
      21st Jun 2005
I am looking for some calendar software where I can input the
"weekday" and a "date number" and the software then tells me which
months that date fell on that weekday?

For example, if I provided this info: "Friday the 9th in 2004"
then the software would tell me "January, April and July".

I can't find anything in Calendar Magic to do this - unless I am
overlooking something in it.

 
Reply With Quote
 
 
 
 
Andreas Kaestner
Guest
Posts: n/a
 
      21st Jun 2005
Jane D ((E-Mail Removed)) schrieb/wrote:

> I am looking for some calendar software where I can input the
> "weekday" and a "date number" and the software then tells me which
> months that date fell on that weekday?
>
> For example, if I provided this info: "Friday the 9th in 2004"
> then the software would tell me "January, April and July".


Copy the lines between the "cut here" marks and save them
to a textfile(!) named findmonth.vbs (the name doesn't matter,
the .vbs extension is important).

Doubleclick findmonth.vbs to start the script.

Following input will be accepted:

friday 13 2005
friday 13 (if year is missing, current year will be assumed)
friday 13th
fr 1st (only the first two letters of the day are relevant)
super 3nd (assume sunday (su),
all "st", "nd", "rd" in the number will be discarded)

Enjoy!
Andreas

===== cut here =====
' find relevant months from specified day and date number
' by AcK 21-Jun-2005 (E-Mail Removed)
' Freeware for private and commercial use

Option Explicit
Dim inp, result, help

help = "Enter day, number, year" & vbCRLF & _
"Example: Friday 13 2005" & vbCRLF & _
"omit year ==> assume current year" & vbCRLF & vbCRLF

Do
inp = Trim(InputBox(help & result, "Find Months", inp))
result = ""
If inp <> "" Then FindMonths inp
Loop Until inp = ""

WScript.Quit

Sub FindMonths(str)
Dim wrk, datearr, i, wday

datearr = Split(str)
i = UBound(datearr)
If i = 1 Then
ReDim Preserve datearr(i+1)
datearr(2) = Year(Date)
End If
datearr(0) = UCase(Left(datearr(0), 1)) & _
LCase(Mid(datearr(0), 2, Len(datearr(0))))
datearr(1) = Replace(UCase(datearr(1)), "ST", "")
datearr(1) = Replace(UCase(datearr(1)), "ND", "")
datearr(1) = Replace(UCase(datearr(1)), "RD", "")
inp = datearr(0) & " " & datearr(1) & " " & datearr(2)

Select Case UCase(Left(datearr(0), 2))
Case "SU" : wday = 1
Case "MO" : wday = 2
Case "TU" : wday = 3
Case "WE" : wday = 4
Case "TH" : wday = 5
Case "FR" : wday = 6
Case "SA" : wday = 7
End Select
For i = 1 To 12
wrk = datearr(1) & "-" & i & "-" & datearr(2)
If DatePart("w", wrk) = wday Then
result = result & datearr(0) & " " & wrk & vbCRLF
End If
Next

End Sub
===== cut here =====


--
Gruß, | Bitte in der NG antworten | Win98-Tipps:
Regards, Andreas | Please reply to the NG | http://a-kaestner.de
==================*===========================*=======================72
OE-QuoteFix 1.19.2: http://home.in.tum.de/~jain/software/oe-quotefix/

 
Reply With Quote
 
B. R. 'BeAr' Ederson
Guest
Posts: n/a
 
      21st Jun 2005
On Tue, 21 Jun 2005 14:15:54 +0100, Jane D wrote:

> I am looking for some calendar software where I can input the
> "weekday" and a "date number" and the software then tells me which
> months that date fell on that weekday?
>
> For example, if I provided this info: "Friday the 9th in 2004"
> then the software would tell me "January, April and July".


GCal can do this. But beware, it has a very exhaustive syntax. You
get this program here:

http://gnuwin32.sourceforge.net/packages/gcal.htm

If you look at the GCal command line syntax you see this:

gcal [ [option . . . ] [%date] [@file . . . ] ] [command]

If not told otherwise GCal works with the current date in mind.
For this date it pops up calendar sheets, gives you a list of
appointments, evaluates holiday lists, and so on.

Nothing of this will help you much with Fridays in 2004. The %date
parameter makes GCal operating as if today would be another day.
That's, too, not what you'd like to achieve. The @file parameter
only feeds GCal with script files. That's too complicated for your
simple task.

The command parameter, OTOH, permits you to evaluate expressions
defined via 'options' and resource files for specific combinations
of years and months. That's better, isn't it? ;-)

In your case a simple command '2004' will do. To define a span of
years you could use '2002+2004' (that's 2002 up to 2004) or a
list of years like this: '2002;2003;2006'. If you need to select
(spans or lists of) months, too, please consult the docs.

Now we have GCal looking at the time frame we want it to. Next
step is to decide the operation mode. We would like neither some
calendar sheet output nor some date based appointment evaluation.
In fact: We want something which GCal calls 'Fixed date list'.
Therefore our first option is -u (= don't display calendar sheets).

The second option tells GCal to accept a date formula from
command line rather than from resource files (the default).
It's the -# option followed by a string in quotation marks.

If you don't like the subheaders of the output you may include
the -x option as well.

Now to the date formula. Because the target year is already
set as a command (in fact: is has to), the formula can be a
very universal one.

We tell GCal to scan through arbitrary years (= 0 [you could
replace that by 2004 if you better like that]) from first
Friday (= *d1fri) to the last (= #99fri) in steps of 7 days
(= .7). Moreover we only want days included (= %i), which
have any year (= 0000), any month (= 00) and only 9 as a
date (= 09). To finish the include span (= #) we add the
same date (= 00000009) once again.

The whole command line looks those:

gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004

Output redirection (append: > Fri09.txt) sends the results
to (at this example) Fri09.txt.

HTH.
BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
 
Reply With Quote
 
Alex Balfour
Guest
Posts: n/a
 
      21st Jun 2005
"Jane D" <(E-Mail Removed)> wrote in message
news:967C911D22A1A72A58@204.153.244.156...
>I am looking for some calendar software where I can input the
> "weekday" and a "date number" and the software then tells me which
> months that date fell on that weekday?
>
> For example, if I provided this info: "Friday the 9th in 2004"
> then the software would tell me "January, April and July".
>
> I can't find anything in Calendar Magic to do this - unless I am
> overlooking something in it.


Calendar Magic will do it, although not very elegantly. Bring up the
Calendar Comparison screen and set say the left-hand calendar to January
in 2004. Left-click day 9 to colour it red for easy visibility. Then use
the month spin button to move quickly through January, February, March
etc. and note any month where the "red 9" is in the Friday column.

If this is a capability you require to use regularly, let me know and
I'll add something better to the next release.

Alex Balfour

 
Reply With Quote
 
Andreas Kaestner
Guest
Posts: n/a
 
      21st Jun 2005
B. R. 'BeAr' Ederson ((E-Mail Removed)) schrieb/wrote:

[Full quote intended]

>> I am looking for some calendar software where I can input the
>> "weekday" and a "date number" and the software then tells me which
>> months that date fell on that weekday?
>>
>> For example, if I provided this info: "Friday the 9th in 2004"
>> then the software would tell me "January, April and July".

>
> GCal can do this. But beware, it has a very exhaustive syntax. You
> get this program here:
>
> http://gnuwin32.sourceforge.net/packages/gcal.htm
>
> If you look at the GCal command line syntax you see this:
>
> gcal [ [option . . . ] [%date] [@file . . . ] ] [command]
>
> If not told otherwise GCal works with the current date in mind.
> For this date it pops up calendar sheets, gives you a list of
> appointments, evaluates holiday lists, and so on.
>
> Nothing of this will help you much with Fridays in 2004. The %date
> parameter makes GCal operating as if today would be another day.
> That's, too, not what you'd like to achieve. The @file parameter
> only feeds GCal with script files. That's too complicated for your
> simple task.
>
> The command parameter, OTOH, permits you to evaluate expressions
> defined via 'options' and resource files for specific combinations
> of years and months. That's better, isn't it? ;-)
>
> In your case a simple command '2004' will do. To define a span of
> years you could use '2002+2004' (that's 2002 up to 2004) or a
> list of years like this: '2002;2003;2006'. If you need to select
> (spans or lists of) months, too, please consult the docs.
>
> Now we have GCal looking at the time frame we want it to. Next
> step is to decide the operation mode. We would like neither some
> calendar sheet output nor some date based appointment evaluation.
> In fact: We want something which GCal calls 'Fixed date list'.
> Therefore our first option is -u (= don't display calendar sheets).
>
> The second option tells GCal to accept a date formula from
> command line rather than from resource files (the default).
> It's the -# option followed by a string in quotation marks.
>
> If you don't like the subheaders of the output you may include
> the -x option as well.
>
> Now to the date formula. Because the target year is already
> set as a command (in fact: is has to), the formula can be a
> very universal one.
>
> We tell GCal to scan through arbitrary years (= 0 [you could
> replace that by 2004 if you better like that]) from first
> Friday (= *d1fri) to the last (= #99fri) in steps of 7 days
> (= .7). Moreover we only want days included (= %i), which
> have any year (= 0000), any month (= 00) and only 9 as a
> date (= 09). To finish the include span (= #) we add the
> same date (= 00000009) once again.
>
> The whole command line looks those:
>
> gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004
>
> Output redirection (append: > Fri09.txt) sends the results
> to (at this example) Fri09.txt.


That sounds a bit primitive to me ))

--
Gruß, | Bitte in der NG antworten | Win98-Tipps:
Regards, Andreas | Please reply to the NG | http://a-kaestner.de
==================*===========================*=======================72
OE-QuoteFix 1.19.2: http://home.in.tum.de/~jain/software/oe-quotefix/

 
Reply With Quote
 
Jane D
Guest
Posts: n/a
 
      22nd Jun 2005
On Tue 21 Jun 2005 20:19:10, B. R. 'BeAr' Ederson wrote:
<news:15wiwwtlqxiys$.(E-Mail Removed)>
>
> The whole command line looks those:
>
> gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004



Yikes!
 
Reply With Quote
 
Jane D
Guest
Posts: n/a
 
      22nd Jun 2005
On Tue 21 Jun 2005 17:56:09, Andreas Kaestner wrote:
<news:42b845e0$0$1141$(E-Mail Removed)>

> Jane D ((E-Mail Removed)) schrieb/wrote:
>
>> I am looking for some calendar software where I can input the
>> "weekday" and a "date number" and the software then tells me
>> which months that date fell on that weekday?
>>
>> For example, if I provided this info: "Friday the 9th in 2004"
>> then the software would tell me "January, April and July".

>
> Copy the lines between the "cut here" marks and save them
> to a textfile(!) named findmonth.vbs (the name doesn't matter,
> the .vbs extension is important).
>


cut

>
> Enjoy!
> Andreas
>


Thank you very much. :-)
 
Reply With Quote
 
Jane D
Guest
Posts: n/a
 
      22nd Jun 2005
> "Jane D" <(E-Mail Removed)> wrote in message
> news:967C911D22A1A72A58@204.153.244.156...
>>I am looking for some calendar software where I can input the
>> "weekday" and a "date number" and the software then tells me
>> which months that date fell on that weekday?
>>
>> For example, if I provided this info: "Friday the 9th in 2004"
>> then the software would tell me "January, April and July".
>>
>> I can't find anything in Calendar Magic to do this - unless I
>> am overlooking something in it.



On Tue 21 Jun 2005 21:30:57, Alex Balfour wrote:
<news:42b8791e$0$2411$(E-Mail Removed)>
>
> Calendar Magic will do it, although not very elegantly. Bring up
> the Calendar Comparison screen and set say the left-hand
> calendar to January in 2004. Left-click day 9 to colour it red
> for easy visibility. Then use the month spin button to move
> quickly through January, February, March etc. and note any month
> where the "red 9" is in the Friday column.
>
> If this is a capability you require to use regularly, let me
> know and I'll add something better to the next release.
>
> Alex Balfour



Alex, I would welcome some sort of feature to do this calculation.

I am one of those people who make a quick note of something on
paper and write its date as "Tuesday 16th".

Much later on I find that I still have the note and have kept it
for longer than I expected. Then I am left to work out which
month I made the note in. In fact, often I have to work out which
month and which year.

So I am someone who would definitely appreciate it if you could
include something like this capability in the next release of
Calendar Magic. CM is a very comprehensive program and I use it a
lot. Thank you for it.

BTW it would be nice if Calendar Magic would accept ESC as a
shortcut to Return To Main Menu (in addition to Alt-M).
 
Reply With Quote
 
B. R. 'BeAr' Ederson
Guest
Posts: n/a
 
      22nd Jun 2005
On Tue, 21 Jun 2005 22:51:11 +0200, Andreas Kaestner wrote:

>> The whole command line looks those:
>>
>> gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004
>>
>> Output redirection (append: > Fri09.txt) sends the results
>> to (at this example) Fri09.txt.

>
> That sounds a bit primitive to me ))


The output redirection string? Yeah, I got the same nasty feeling... ;-)

BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
 
Reply With Quote
 
B. R. 'BeAr' Ederson
Guest
Posts: n/a
 
      22nd Jun 2005
On Wed, 22 Jun 2005 14:26:47 +0100, Jane D wrote:

> On Tue 21 Jun 2005 20:19:10, B. R. 'BeAr' Ederson wrote:
> <news:15wiwwtlqxiys$.(E-Mail Removed)>
>>
>> The whole command line looks those:
>>
>> gcal -# "0*d1fri#99fri.7 %i00000009#00000009" -u -x 2004

>
>
> Yikes!


Okay, okay. Let's simplify things a bit. First create a batch file
named Datetest.bat (for instance). After that copy the following
string to the batch (note the additional percent sign before the
letter i beside the other changes):

gcal -# "0*d1%1#99%1.7 %%i000000%2#000000%2" -u -x %3

After you saved this file you can call the batch whenever you want
this way:

Datetest Fri 09 2004

----- End of required operations. Some comments follow. -----

The first parameter is always the day of the week and can have 2
or 3 chars. The second holds the day of the month and has always
to be 2 digits. The last holds the command string. It can be a
simple year like above or a more complex statement like this:

Datetest Th 13 01/2003-11/2007
or
Datetest Th 13 Jan/2003-Nov/2007

(That will check from 1th of January 2003 to the 30th of November
in 2007 for a Thursday, the 13th. Look inside the GCal docs for
all possible combinations.)

Parameter containing a comma or semicolon can only be built with
WinNT based systems like Win2k or WinXP. You'd need to call the
batch via cmd.exe like this:

cmd /c Datetest Fri 04 "2001;2003;2005"

In that case the last parameter has to be enclosed in quotation
marks.

Does it look simpler to you, now? No? Than you have to get one of
those command line replacements which allow shortcuts, ask for
parameters, and so on. Integrate the above Batch into one of those
and life will be as simple as GCal will never get. ;-)

BeAr
--
===========================================================================
= What do you mean with: "Perfection is always an illusion"? =
===============================================================--(Oops!)===
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
add number of months to date =?Utf-8?B?dGluYQ==?= Microsoft Access Form Coding 3 24th Jul 2007 01:34 PM
Find the date 6 months later =?Utf-8?B?RmlsaXBlbXI=?= Microsoft Excel Worksheet Functions 11 22nd May 2007 06:40 PM
Time range to workdays in relevant months =?Utf-8?B?THVraW5v?= Microsoft Excel Programming 4 13th Jun 2006 07:39 AM
How to find a date six months ago Frederick Wilson Microsoft Access Form Coding 5 1st Feb 2005 07:55 PM
Add a number of months to a date Deuce Sapp Microsoft Access 6 30th Jun 2004 06:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:51 AM.