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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kumar_kondapalli
Posts: 32
Joined: 08 Jul 2011 03:38

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

#1 Post by kumar_kondapalli » 16 Aug 2011 06:06

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

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

#2 Post by aGerman » 17 Aug 2011 13:30

Have a look at the DateToWeek function on this website:

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

Regards
aGerman

Ocalabob
Posts: 79
Joined: 24 Dec 2010 12:16
Location: Micanopy Florida

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

#3 Post by Ocalabob » 24 Aug 2011 23:48

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!

Post Reply