Jump to content
Sign in to follow this  
Doxie

Countdown from specific date?

Recommended Posts

Doxie

Hi, its me again :ph34r:

I'm making a inventory program, and everything is working just fine.

Now i have just added the GUI "Date", so i can add when we purshased a device.

But next to the date, i would like to have a countdown from 3 years, so we can see quickly how long the user will keep their device.

I got one interface were i can edit, the inventory, and one view interface.

When i'm using the edit, i get a GUI "Date" after each device.

Now i wanna see a # of days left on the view.

This is from my .ini file:

Date=den 31 juli 2004

Is there anyway i can get a number count from that day 3 years forward?

And then countdown it for eachday?


Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites
Davman

hmm... well...

3 years from 31st july 2004 is, 31st july 2007.

subtract one date from the other and you'll have the amount of days.


Sitting comfortably behind the code.

Share this post


Link to post
Share on other sites
Doxie

I wish it was that easy :ph34r:

Since i'm using Jan, Feb etc... It can´t be calculated that easy,

i first need to change to make a code for how many days its in Jan, Feb

Well and alot of other code, this is to complicated :(

I drop this question...


Were ever i lay my script is my home...

Share this post


Link to post
Share on other sites
Davman

mm, dont forget leap years :ph34r:


Sitting comfortably behind the code.

Share this post


Link to post
Share on other sites
Jos

I have developed a bunch of date functions back in february to be included in the standard UDF library that is being compiled ... I believe they are still supposed to be published soon together with the new AutoIt3 release.

Here is a preview/beta version of these date functions in a file called http://www.autoitscript.com/fileman/users/jdeb/test/datenew.au3.

It includes a _DateDiff function which does what you need:

#include <datenew.au3>
msgbox(0,'test',_datediff('d',"2004/12/31", "2005/01/01"))

Let me know when you find bugs or issues with it.

this is the list of extra function on top of the current DATE.AU3:

; _DateAdd, _DateDiff, _DateToDayValue, _DayValueToDate

; _FormatDateTime, _DayOfWeek, _DateIsValid

; _SplitDateTime, _Now(), _NowTime(), _NowDate(),_DaysInMonth()

; _DaysOfWeek(), Nowcalc(), _JulianDayNo(), _JulianToDate($iJDay)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.