Sign in to follow this  
Followers 0
ces1a

Date Difference

1 post in this topic

#1 ·  Posted

This is an easy way to get the number of days between today and any future date without having to acount for Hours, Minutes, and Seconds.

#include <Date.au3>

Func ShowDays($FutureDate)
    $iDaysDiff = _DateDiff('D', _NowCalcDate(), $FutureDate)
    If $iDaysDiff < 1 Then Return 0 ;Insure only positive return
    Return $iDaysDiff
EndFunc ;==GoPR

MsgBox(0, '',  ShowDays("2017/07/31"))

I use it to know how many days till I go on my next vacation.

Maybe one of you can find a use for it.

Share this post


Link to post
Share on other sites



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
Sign in to follow this  
Followers 0

  • Similar Content

    • Chimp
      By Chimp
      Hi
      I ask for generic advice on what field format is best to use to store dates in a database (SQLite).
      if is a better choice to stored separately year, month and day into 3 separate fields or use one field for a complete date-time group?
      I have to store information of this kind:
      a person is assigned to a job for a certain day (one day only)
      or also
      a person is assigned to a job from a day to another day (a range of days)
      then i have to query the database for a certain day so to know who is working to a certain job in a specific day.
      Well, in the case of ranges of days (for example Mr. Bean works to JOB1 from May/15 to May/20) I have to store one record for each day of the range (6 record in this case) or use only one record with both dates in 2 fields of the same record?
      the SQL query should 'ask' who is working on a specific day (even for days in the middle of the ranges).
      My doubt is, what's the best way to store ranges of dates (as in the above example), so to be facilitated in the retrieval of those informations.
      I'm afraid I'm not been clear, even if I did my best to be, anyway .... any suggestion is welcome..
      Thank You
    • chakka
      By chakka
      Hello all,

      How to calculate the nearest Sunday?

      2012/12/30 (Previous Sunday) 2013/01/03(Today) 2013/01/06(Coming Sunday) Here considering today's date(2013/01/03) the nearest Sunday is coming Sunday(2013/01/06)
      How to achieve this using AutoIt? any function close to this?

      Thanks