Page 1 of 1

How Do we Calculate the Weeknumber for a given date in a yea

Posted: 16 Aug 2011 06:06
by kumar_kondapalli
HI All,

I want to have a bat file to Calculate the Week number for a Given Date in an Year

For example Today date is 16 the the week is 33

Iam new to Bat code . STEP by STEP would be more helpful for me

Thanks,
San

Re: How Do we Calculate the Weeknumber for a given date in a

Posted: 17 Aug 2011 13:30
by aGerman
Have a look at the DateToWeek function on this website:

http://www.commandline.co.uk/lib/treeview/index.php

Regards
aGerman

Re: How Do we Calculate the Weeknumber for a given date in a

Posted: 24 Aug 2011 23:48
by Ocalabob
Greetings San!

You're asking for a batch file solution that would better be solved
with a HLL or an Excel spreadsheet. Both would deal with 'week 33'
that you typed. Week 33 conforms to ISO 8601 Date and Time Standards
which I believe you are looking for rather than a calendar date
week of say January 2, 2011 which falls into week 52 of 2010 by ISO
standards.

The first challenge would be to get SWN (Simple Week Number) into
a variable and then proceed with some 'set /a' math to noodle
out the ISO week. Not a trivial task, but possible with WMIC
provided you have XP Pro or better.

A quick question San. I'm in the USA and the ISO week number is rarely
used. What do you need it for?

Post back if you would like to continue.

Best wishes San!