-5

This is my table

Sample(tablename) -Day_start(column1) -Day_end(column2) -Total_days(column3) -Days_left(column4)

Day_start(column1) -March 1 2017(data)

Day_end(column2) -April 5 2017(data)

Total_days(column3) -36 (data)

days_left(column4) -36(data)

Sorry for my last question, im not good in English!.. So this is my question In the day of March 2 2017 the days left must be 35. so everyday the days_left will decrease automatically I only know the code of between two dates whichis my total_days. But I dont know how to decrease it by 1 automatically per day . Then it will diplay in the table of netbeans

Rush
  • 1
  • 2
  • Are you asking how to persist / store your label's value? – Filburt Mar 21 '17 at 08:10
  • Example the jlabel has a text of 24 then tomorrow the text should be 23 automatically – Rush Mar 21 '17 at 08:36
  • Give more details how your program works. Running 24 hours a day without closing? Or launch every day? – xhg Mar 21 '17 at 09:08
  • Possible duplicate of [How do I save preference user settings in Java?](http://stackoverflow.com/questions/4017137/how-do-i-save-preference-user-settings-in-java) – PlusInfosys Mar 21 '17 at 09:30
  • 1
    I did get the *user story* from your question - you need to tell us what your specific *programming problem* is. We don't know if your problem is storing the current value closing the application or determining if you need to decrement your value on application startup (Closing and opening the application several time on one day). – Filburt Mar 21 '17 at 09:55
  • I edit my question – Rush Mar 21 '17 at 14:20

1 Answers1

1

well you can store the current date somewhere in a file. then when the program runs again you can compare the date from the file with the current data, finally create a function to find the diffrence in days since the program was last opened. you can als just print the date it was last opened.

Mikenno
  • 294
  • 3
  • 9