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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:50:14+00:00 2026-05-30T08:50:14+00:00

i studying TDateTime functions and procedure, but not found something that allow me to

  • 0

i studying TDateTime functions and procedure, but not found something that allow me to convert a number of days in equivalent Year, Month, Day, for example, if i have days = 0 i should to have as result:

Year:   0
Month:  0
Day:    0

or i have days = 1, should have:

Year:   0
Month:  0
Day:    1   // Just 1 day 

or if i have days = 32:

Year:   0
Month:  1  // January is 31 days
Day:    1  // Day is 1 
           // Total are 32 days 

etc, considering too when february month is of 29 days and not only 28.
In delphi xe2, who can tell me what function do it, or if need write it manually? Thanks very much.

  • 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-05-30T08:50:16+00:00Added an answer on May 30, 2026 at 8:50 am

    Using the methods in DateUtils:

    procedure daysToDate(days: Integer; out day, month, year: Integer);
    var
      january1st: TDateTime;
      targetDate: TDateTime;
    begin
      january1st := StartOfTheYear(Now());
      targetDate := IncDay(january1st, days);
    
      day := DayOfTheMonth(targetDate) - 1;
      month := MonthOfTheYear(targetDate) - 1;
      year := YearOf(targetDate) - YearOf(january1st);
    end;
    

    This code assumes that you are counting the days in the current year. If you want to start in a different year then modify the line january1st := StartOfTheYear(Now()); as needed.

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

Sidebar

Related Questions

Studying C#, my books are showing me classes for readin files. I've found 2
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
While studying the Collection API, we find that some methods ( add , remove
Studying STL I have tried to negate a functor with not2 but encontered problems.
While studying the book Introduction to Algorithms by Cormen, I found a strange thing.
I keep studying this flow of the Facebook's bigpipe technique but I have this
Im studying inline functions in C++ and have come to a section concerning limitations
While studying the Qt framework, I've noticed that it's littered with hundreds of overloaded
Currently studying bitwise arithmetic. It's really easy, because I have some CS background. But
When studying the project 'gproc' source code files, I have found several patch files

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.