1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? Different ways to calculate Difference in Days...

Discussion in 'T&T - Miscellaneous' started by Joe Caverly, Nov 24, 2012.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    698
    Likes Received:
    8
    One method to calculate the Difference in Days is with the @days function from the the ISO8601 Plugin, available from unm.edu/~cdye/dl/iso8601.zip

    From the ISO8601.CHM file;

    Code:
    echo Only %@days[T,%@nextdate[12,25]] days until Christmas!
    echo %@days[T,%@easter[*]] days until Easter.

    Another method is to use the DateDiff function from VBScript;

    Code:
    @setlocal
    @echo off
    text > vbDateDiff.vbs
    shell.writeln(DateDiff("d", Now, "12/25/2013"))
    endtext
    if exist vbDateDiff.vbs script vbDateDiff.vbs
    if exist vbDateDiff.vbs del vbDateDiff.vbs > nul
    endlocal

    Another method is to use the @DAYSDIFF function from the FedUtils plugin, available from ftp://ftp.jpsoft.com/plugins/fedutils9.zip


    Code:
    echo %@DAYSDIFF[%_ISODATE,2012-12-25]
    Some other examples can be found at;
    http://jpsoft.com/forums/threads/days-until-december-25.1462/#post-7306

    Share your method on how you calculate the Difference in Days.

    Joe
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Using only TCC, you can simply subtract %@DATE[date1] from %@DATE[date2], provided both are in the range of 1980 - 2099.
     

Share This Page