Skip to content

Getdate #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions DateAndTime/GetData.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@echo off
Rem To get month
IF %date:~3,2%==01 set month=JANUARY
IF %date:~3,2%==02 set month=FEBRUARY
IF %date:~3,2%==03 set month=MARCH
IF %date:~3,2%==04 set month=APRIL
IF %date:~3,2%==05 set month=MAY
IF %date:~3,2%==06 set month=JUNE
IF %date:~3,2%==07 set month=JULY
IF %date:~3,2%==08 set month=AUGUST
IF %date:~3,2%==09 set month=SEPTEMBER
IF %date:~3,2%==10 set month=OCTOBER
IF %date:~3,2%==11 set month=NOVEMBER
IF %date:~3,2%==12 set month=DECEMBER
Rem to get day
set Day=%date:~0,2%
Rem Day lapse
if %time:~,2% LSS 12 set lapse=Morning
if %time:~,2% GEQ 12 set lapse=Afternoon
if %time:~,2% GEQ 20 set lapse=Night
rem set year
set year=%DATE:~6,4%
Rem result
echo.Time: %time% (%lapse%)
echo.Day: %day%
echo.Month: %month%
echo.Year: %year%
pause>nul&exit /b