i have looked all over this forum but i cant seem to find what im looking for.
I have a date in the following format:
Code: Select all
Fri, 27 Aug 2021 12:37:30 GMT
Can someone please help me?
Thank you
Moderator: DosItHelp
Code: Select all
Fri, 27 Aug 2021 12:37:30 GMT
Code: Select all
@echo off &setlocal EnableDelayedExpansion
set "dt1=Fri, 27 Aug 2021 12:37:30 GMT"
set "dt2=Fri, 27 Aug 2021 12:37:31 GMT"
for %%i in ("Jan=01" "Feb=02" "Mar=03" "Apr=04" "May=05" "Jun=06" "Jul=07" "Aug=08" "Sep=09" "Oct=10" "Nov=11" "Dec=12") do set %%i
for /f "tokens=2-7 delims=: " %%i in ("%dt1%") do set "timestamp1=%%k!%%j!%%i%%l%%m%%n"
for /f "tokens=2-7 delims=: " %%i in ("%dt2%") do set "timestamp2=%%k!%%j!%%i%%l%%m%%n"
echo %timestamp1%
echo %timestamp2%
pause
Code: Select all
@echo off &setlocal EnableDelayedExpansion
set "dt1=Fri, 27 Aug 2021 12:37:30 GMT"
set "dt2=Fri, 27 Aug 2021 12:37:31 GMT"
for %%i in ("Jan=01" "Feb=02" "Mar=03" "Apr=04" "May=05" "Jun=06" "Jul=07" "Aug=08" "Sep=09" "Oct=10" "Nov=11" "Dec=12") do set %%i
for /f "tokens=2-7 delims=: " %%i in ("%dt1%") do set "timestamp1=%%k!%%j!%%i%%l%%m%%n"
for /f "tokens=2-7 delims=: " %%i in ("%dt2%") do set "timestamp2=%%k!%%j!%%i%%l%%m%%n"
echo %%timestamp1%% == %timestamp1%
echo %%timestamp2%% == %timestamp2%
if %timestamp1% GTR %timestamp2% (echo(%%timestamp1%% is greater) else (echo(%%timestamp2%% is greater)
if %timestamp1% EQU %timestamp2% echo Timestamps are equal
pause