Jump to content

Date Difference in Years, months and days


Go to solution Solved by water,

Recommended Posts

Posted

I'm trying to figure out how to use _DateDiff to create the result in Years, Months and Days.  For instance, the difference between 7/12/2020 and 10/23/2023 is 3 years 3 months 11 days.

I can get the Years using  _DateDiff( "Y", "2020/7/12", "2023/10/23"  )

I can get the Months using:

$sTempMons = _DateDiff( "M", "2020/7/12", "2023/10/23")
$sMonths = Mod( $sTempMons, 12)

But I am at a loss how to get the number of days. Any thoughts?

Tia,

MCohen

  • Solution
Posted (edited)

Welcome to AutoIt and the Forum!

I think this is what you are looking for. The forum search feature popped up this result as #3 ;)

 

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I searched for "_datediff years months days" :)

My UDFs and Tutorials:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...