For the conversion you can do like this:
conv.bat
Code:
@ echo off
set example = 2003_050
:: Extraction of the Year
set A =% EXAMPLE: ~ 0.4%
:: Extraction of Quantième
set / a Q = 1% EXAMPLE: ~ 5,3% - 1000
:: Calculation of Julian day from 1 January of the year%% A +% Q% days
set / a = JJ% Q% + ((1461 * (% A +% 4800 + (1 - 14) / 12)) / 4 + (367 * (1 - 2 - 12 * ((1 - 14) / 12 ))) / 12 - (3 * ((%% A + 4900 + (1 - 14) / 12) / 100)) / 4 + 1 - 32075) - 1
:: Convert Julian Day to Day (% J%), Month (M%%) and Year (% A%)
set / a T0 =% DD% + 68569
set / a T1 = (T0 *% 4%) / 146097
set / a T0 = T0%% - (146097 *% Q1% + 3) / 4
set / a T2 = (4000 * (%% T0 + 1)) / 1461001
set / a T0 = T0%% - (1461 *% Q2%) / 4 + 31
set / a T3 = (80 *% T0%) / 2447
set / a J = T0%% - (2447 *% Q3%) / 80
set / a M =% Q3% + 2 - (12 * (% Q3% / 11))
set / a A = 100 * (% Q1% - 49) +% +% Q2 (% T3% / 11)
:: Formatting resultat
if% J% LSS 10 set J = J% 0%
if% M% LSS 10 set M = M% 0%
echo.
Before conversion echo:%% EXAMPLE
echo after conversion:% A% M% _% _% J%
echo. & Pause
Result
Before conversion: 2003_050
After conversion: 2003_02_19
Press any key to continue ...
Bookmarks