Topic: How Edit Script Calculator datediff When DateTimePicker On_Change

How To edit script when DateTimePicker  On_Change and display in lable or textbox

sample
A = Start Date (01/01/2015)
B = Stop Date (25/06/2015)
Answer
B - A
Display = " Year=0 Month=5 Day=24 "


How to edit Script  ?
My Student  Ark me  but I Haven't Answer because function this can apply birth ,expire date or etc
help me please !
Download My Project
09 Lesson Script.zip

Sample Screen Shot
http://s21.postimg.org/nfhhlv3bn/2015_06_25_Image_001.jpg

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

I remember having the need to count the elapsed time to manage quarantine at some point but I was using SQL statement with "julianday" function:


select .......,

round(julianday('now') - round(julianday(<starting_date>))


from table


more here : http://www2.sqlite.org/cvstrac/wiki?p=D … eFunctions

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

Thank You Very much
But I need Show effect in lable not in table

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

Hi Prahousefamily,
Picking up on Tcoton's answer, you could try something like this to output it as a label;

procedure Form1_DateTimePicker2_OnChange (Sender: string);
begin
  form1.Label4.caption:= inttostr(daysbetween(form1.datetimepicker1.date,form1.datetimepicker2.date));
end;

It only shows the elapsed period in 'days', not as 'years, months and days', but the principle is the same.

I knocked up a quick project to show it working if you need to have a look.

Good Luck,
Derek.

Post's attachments

Attachment icon twodates.zip 334.73 kb, 573 downloads since 2015-06-26 

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

Hi derek.
Thank  You for sample download but i use My Visual Database 1.46 can not open project
I need Try  send sample by old version ..
Help me please
Pra House Family
http://s10.postimg.org/wobzpj3gl/2015_06_26_Image_001.jpg

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

prahousefamily
Example for you.
But you can't use TextBox for entering a date.

Post's attachments

Attachment icon 09 Lesson Script_fixed.zip 4 kb, 589 downloads since 2015-06-26 

Dmitry.

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

The last script does not work in 1.51.

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

tcoton
Checked, works, what exactly don't work?

Dmitry.

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

prahousefamily
Your using My Visual Database in an educational institution?
If yes, I can give you free license for the educational institution.

Dmitry.

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

The last label at the bottom of the form does not calculate anything smile

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

tcoton
Yes, because you can't enter date in the TextBox, the last label at the bottom don't work.

Dmitry.

12 (edited by prahousefamily 2015-06-27 09:34:31)

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

How have free license for the educational ?
i work in small hospital and free teach in "basic database and apply in your work" 
my student is children student ,doctor,nurse and people etc

by use my visual database 1.2 1.3 to 1.46 for teach because free edition 
but 1.47 and later not free and in i haven't  license

Thank You .... My Visual Database Example easy for my student
http://www.bloggang.com/data/m/mrpostcard/picture/1409626181.jpg

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

prahousefamily
Please, contact with me by email: support@drive-software.com
Let me know name of hospital.

Dmitry.

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

I also work in hospital and make program for my hospital. How can I get a free license for the educational?

Re: How Edit Script Calculator datediff When DateTimePicker On_Change

pha1984
You can get free license,  If you teach other people in class.

Dmitry.