answersLogoWhite

0


Best Answer

I finally took the time to do this myself:

@echo off

cls

color f0

:Date

cls

SET Today=%Date: =0%

SET Year=%Today:~-4%

SET Month=%Today:~-10,2%

SET Day=%Today:~-7,2%

:LEAPYEARPARSE

cls

SET Leap=0

FOR %%A IN (1980 1984 1988 1992 1996 2000 2004 2008 2012 2016) DO IF %Year%==%%A SET Leap=1

FOR %%A IN (2020 2024 2028 2032 2036 2040 2044 2048 2052 2056) DO IF %Year%==%%A SET Leap=1

FOR %%A IN (2060 2064 2068 2072 2076 2080 2084 2088 2092 2096) DO IF %Year%==%%A SET Leap=1

FOR %%A IN (2104 2108 2112 2116 2120 2124 2128 2132 2136 2140) DO IF %Year%==%%A SET Leap=1

FOR %%A IN (2144 2148 2152 2156 2160 2164 2168 2172 2176) DO IF %Year%==%%A SET Leap=1

:CleanUp

cls

if %Month%==01 set Month=1

if %Month%==02 set Month=2

if %Month%==03 set Month=3

if %Month%==04 set Month=4

if %Month%==05 set Month=5

if %Month%==06 set Month=6

if %Month%==07 set Month=7

if %Month%==08 set Month=8

if %Month%==09 set Month=9

if %Day%==01 set Day=1

if %Day%==02 set Day=2

if %Day%==03 set Day=3

if %Day%==04 set Day=4

if %Day%==05 set Day=5

if %Day%==06 set Day=6

if %Day%==07 set Day=7

if %Day%==08 set Day=8

if %Day%==09 set Day=9

:DOY

cls

if %Month%==1 set DOY=%Day%

if %Month% GEQ 2 goto LEAPDOY

goto END

:NOTLEAP

cls

if %Month%==2 set/a DOY=%Day%+31

if %Month%==3 set/a DOY=%Day%+59

if %Month%==4 set/a DOY=%Day%+90

if %Month%==5 set/a DOY=%Day%+120

if %Month%==6 set/a DOY=%Day%+151

if %Month%==7 set/a DOY=%Day%+181

if %Month%==8 set/a DOY=%Day%+212

if %Month%==9 set/a DOY=%Day%+243

if %Month%==10 set/a DOY=%Day%+273

if %Month%==11 set/a DOY=%Day%+304

if %Month%==12 set/a DOY=%Day%+334

goto End

:LEAPDOY

cls

if not %Leap%==1 goto NOTLEAP

if %Month%==2 set/a DOY=%Day%+31

if %Month%==3 set/a DOY=%Day%+60

if %Month%==4 set/a DOY=%Day%+91

if %Month%==5 set/a DOY=%Day%+121

if %Month%==6 set/a DOY=%Day%+152

if %Month%==7 set/a DOY=%Day%+182

if %Month%==8 set/a DOY=%Day%+213

if %Month%==9 set/a DOY=%Day%+244

if %Month%==10 set/a DOY=%Day%+274

if %Month%==11 set/a DOY=%Day%+305

if %Month%==12 set/a DOY=%Day%+335

goto End

:End

cls

echo.

echo The day of the year is %DOY%

echo.

exit

It could be shorter but I don't feel like making it shorter. Go ahead and edit this if you want.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How would you parse the day of the year in a batch file?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Do you have to file a prior year tax returns before you file for 2009?

It would probably be a good idea to file the prior year one first but you can choose to file the one that you want to file first.


What is the speech choir piece in grade 7 school year batch 2012-2013?

The speech choir piece for a specific school year and batch would vary depending on the school and its chosen curriculum. It is recommended to contact the school directly or consult with former students from that batch for the specific information you are seeking.


Which year was the first batch of baking powder sold?

== ==


When would you need to file form1099-g on your taxes?

You would need to file a 1099-g form, only if you have received a refund from the department in the previous year.


Can I claim my kids if I didn't work?

Unfortunately no. You would have to had worked in the year 2008 to file taxes. In order to claim your children you would have to work and file taxes.


How many Foreigner students in GIKI topi?

more than 25 par batch.. each batch contains about 300 students every year.


Can I file last year's tax this year?

Yes just use the last years tax forms for this purpose. In the year 2010 you would use the 2009 tax forms to file for the 2009 tax year income tax return.


If you were to get married this year would you receive a tax credit when filing your taxes at the end of the year?

You could file jointly if that is what you mean.


How can you file combined taxes for two years?

You MUST file each year seperately. A filing is for ONE accounting period, virtually always a year. Laws, forms and many things change each year. MORE THAN THAT - IT WOULD BE A TERRIBLE THING TO COMBINE YOUR INCOME INTO ONE FILE....YOU WOULD PAY MUCH MORE TAX AND LOSE LOTS OF BENEFITS!


Can you file a tax return from past years if you didn't have an income?

Yes you can, but there would be no advantage to doing so. You would not be required to file income tax returns for any year in which you had no income.


What if your fiscal year is from August 2007 to August 2008 what year do you need for your taxes?

You would file your taxes by December 15, 2008.


If the disposition on one of the records in your file stated destroy after 1 year the disposition would be what?

keep active 1 year, inactive the following year, then destroy