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 9004271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:51:49+00:00 2026-06-16T00:51:49+00:00

I’m sure this must be possible, but I wouldn’t know where to start. I

  • 0

I’m sure this must be possible, but I wouldn’t know where to start.

I need to be able to work out the date based on a number. The number is sequential, and will increase by one each day. So I can do as much as to get the number to be relevant to the number of the day of the year (i.e. Jan 1st would be day 1 etc.) But I need to be able to work out the date in ddmmyyyy format with any given number.

There are similar questions I’ve found relating to C++ and Java Script…

Can this be done in CMD?

Edit

I’ve just realised that the date will change depending on the year (i.e. leapyears)

For my script, the year will always be 2012, so I need to be able to work out the date based on the ordinal (I think thats the right way to describe it) day, for 2012 only.

  • 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-16T00:51:50+00:00Added an answer on June 16, 2026 at 12:51 am

    Code below gets the date from the current date. It’s easy to change it to a fixed year of course.

    I would love to say I wrote this all myself, but it is based on the code by Rob van der Woude. Take a look at the site. It has lots of date calculation functions all of them isolated in separate scripts instead of the fixed-purpose mess I made out of it. 😉

    @echo off
    :: Input: The number of days to add. You can make this a parameter 
    :: too, if you want.
    SET /A Days   = 20
    echo %DATE:~-4%
    
    :: Get 1 january of the current year
    SET /A Year1  = %DATE:~-4% + 4800
    SET MM=1
    SET DD=1
    
    :: Calculate the Julian date of that date.
    SET /A Month1 = ( %MM% - 14 ) / 12
    SET /A JDate  = 1461 * ( %Year1% + %Month1% ) / 4 + 367 * ( %MM% - 2 -12 * %Month1% ) / 12 - ( 3 * ( ( %Year1% + %Month1% + 100 ) / 100 ) ) / 4 + %DD% - 32075
    
    :: Add the number of days
    SET /A JDate  = %JDate% + %Days%
    
    :: Calculate it back to year, month and day.
    SET /A P      = %JDate% + 68569
    SET /A Q      = 4 * %P% / 146097
    SET /A R      = %P% - ( 146097 * %Q% +3 ) / 4
    SET /A S      = 4000 * ( %R% + 1 ) / 1461001
    SET /A T      = %R% - 1461 * %S% / 4 + 31
    SET /A U      = 80 * %T% / 2447
    SET /A V      = %U% / 11
    
    :: SET /A GYear  = 100 * ( %Q% - 49 ) + %S% + %V%
    SET /A GMonth = %U% + 2 - 12 * %V%
    SET /A GDay   = %T% - 2447 * %U% / 80
    
    :: Echo only month and day
    echo %GMonth% %GDay%
    
    :: Clean-up
    FOR %%A IN (P Q R S T U V MM  DD JDate Year1 GDay GMonth GYear) DO SET %%A=
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there's a lot of other questions out there that deal with this
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
Does anyone know how can I replace this 2 symbol below from the string
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.