Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8138665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:33:59+00:00 2026-06-06T11:33:59+00:00

How I can check the date using a calender , what I want to

  • 0

How I can check the date using a calender , what I want to do is that a user insert a date in this way 2012/07/15 , and i want to check if this date exist in the calender .
for example if he insert 2012/14/13 or even 2012/02/31 , i tried to do that manually but its really hard , so my qustions are :

  1. is there a native function(or even 3d party tools) to check date in calender ?

  2. if the user insert date and hour , I want to give same result with different time zone places ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:34:02+00:00Added an answer on June 6, 2026 at 11:34 am

    The subroutine below is comprised of two parts. First it check the date given in 1st parameter and return ERRORLEVEL=1 if the date is bad. You may insert a year valid range if you wish (otherwise, remove the yyOK parts).

    Then it takes a base hour and time-zone adjust in 2nd and 3rd parameters and show the adjusted date.

    :validateDate result= YYYY/MM/DD [HH HHAdjust]
    setlocal EnableDelayedExpansion
    set i=0
    for %%a in (31 28 31 30 31 30 31 31 30 31 30 31) do (
       set /A i+=1
       set daysPerMonth[!i!]=%%a
    )
    set result=Invalid date
    for /F "tokens=1-3 delims=/" %%a in ("%2") do set yy=%%a& set mm=%%b& set dd=%%c
    set /A yy=%yy%, mm=10%mm% %% 100, dd=10%dd% %% 100, yyMOD4=yy%%4 >NUL 2>&1 || goto exit
    if %yyMOD4% equ 0 set daysPerMonth[2]=29
    set /A yyOK=0, mmOK=0, ddOK=0
    rem Modify year limits as you wish (or remove they):
    if %yy% geq 1900 if %yy% leq 2015 set yyOK=1
    if %mm% geq 1 if %mm% leq 12 set mmOK=1
    id %dd% geq 1 if %dd% leq !daysPerMonth[%mm%]! set ddOK=1
    set /A dateOK=yyOK*mmOK*ddOK
    if %dateOK% neq 1 goto exit
    rem Date is correct
    set result=%yy%/%mm%/%dd%
    
    rem Adjust the hour to different time zone, if given
    rem %3=base hour, %4=adjust with sign (+ or -)
    if "%4" equ "" goto exit
    set /A newHH=10%3 %% 100 %4
    if %newHH% gtr 23 (
       rem Pass to next day
       set /A newHH-=24, dd+=1
       if !dd! gtr !daysPerMonth[%mm%]! (
          set /A dd=1, mm+=1
          if !mm! gtr 12 (
             set /A mm=1, yy+=1
          )
       )
    )
    if %newHH% lss 1 (
       rem Pass to previous day
       set /A newHH+=24, dd-=1
       if !dd! lss 1 (
          set /A mm-=1
          if !mm! lss 1 (
             set /A mm=12, yy-=1
          )
          for %%m in (!mm!) do (
             set /A dd=daysPerMonth[%%m]
          )
       )
    )
    set result=%yy%/%mm%/%dd% %newHH%
    
    :exit
    endlocal & set %1=%result%
    exit /B
    

    Test this program and report any problem.

    EDIT: I have modified previous program to fit new OP’s requirements.

    The subroutine no longer returns an ERRORLEVEL value with the result. It must be called now with a new first parameter that indicate the variable that will receive the result, that will be “Invalid date” if original date is bad. If a base and adjustment hours are given, returned value include the adjusted date and hour. For example:

    call validate.bat adjusted= 2012/3/5 3 -2
    if "%adjusted%" neq "Invalid date" (
       echo Adjusted date and hour are: %adjusted%
    )
    

    Antonio

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can check for iPhone with this code: (navigator.userAgent.match(/iPhone/i)) But I want to target
I have a check box list in that user can check or uncheck the
I am using this date picker from jqueryui . If you look on that
I want to check the given date present in from date and todate using
With this code I can check the caret position in a textarea in firefox:
I know that I can check whether the linux timestamp in $time is today
I'm looking for an algorithm that can check if nested regex repeats are reducible.
Just wondering is there any way I can check whether the url links to
I'm aware that I can check an ActiveRecord through the rails console but it
I hope you can help me with this. I've been using jquery datepicker in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.