Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo Off
- SetLocal EnableDelayedExpansion
- :: Unix timestamp to HTTP date format (RFC 1123)
- :: Dependencies: sqlite
- If "%~1"=="" (Echo USAGE: %~nx0 unix timestamp & Exit /B)
- Set Day[]= 0:Sun, 1:Mon, 2:Tue, 3:Wed, 4:Thu, 5:Fri, 6:Sat
- Set Month[]= 01:Jan, 02:Feb, 03:Mar, 04:Apr, 05:May, 06:Jun, 07:Jul, 08:Aug, 09:Sep, 10:Oct, 11:Nov, 12:Dec
- Set "DayName=" & Set "MonthName="
- For /F "eol= tokens=1-4 delims=\" %%A In ('Echo SELECT strftime^(^'%%w\%%d\%%m\%%Y %%H:%%M:%%S GMT^'^, %~1^, ^'unixepoch^'^)^;^|sqlite3') Do (
- For %%Q In (%Day[]%) Do (For /F "tokens=1,2 delims=:" %%R In ("%%Q") Do (If "%%A"=="%%R" Set DayName=%%S))
- For %%Q In (%Month[]%) Do (For /F "tokens=1,2 delims=:" %%R In ("%%Q") Do (If "%%C"=="%%R" Set MonthName=%%S))
- <nul Set /P "Echo=!DayName!, %%B !MonthName! %%D"
- )
- EndLocal
- Exit /B
Advertisement
Add Comment
Please, Sign In to add comment