Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
7
Erster Beitrag:
vor 8 Jahren, 2 Monaten
Letzter Beitrag:
vor 8 Jahren, 2 Monaten
Beteiligte Autoren:
Piet van Zanten, Dan M, Goof.pcs.crosspost, DW, Arie

How do I calculate a future date?

Startbeitrag von Dan M am 30.06.2009 18:22

I am sure this is an easy one (if you can find the function) but I have not been able to find it in the help ...

I want to calculate ... Future date = (Today + X days)

NextCallDate = (DateSys() + 1)

I tried the above and it returns 200906301

which is appending the number one to the end of the date which is being stored as YYYYMMDD.

What is ... or where can I find the command to calculate the future date?

Any help is always appreciated

Dan

Antworten:

Dan, you have several options

NextCallDate = IntegerToDate(DateToInteger(DateSys()) + Xdays)

or

dTmp is date = DateSys()
dTmp..day += Xdays

Note:
dTmp..Day = dTmp..Day + XDays will generate a runtime error - direct assignment is not allowed - see the help for more info

Arie

von Arie - am 30.06.2009 18:44
Hey Dan

Date..Day -=7

or

Date..Day +=7

Dennis

von DW - am 30.06.2009 18:51
Hi Dan,

Some more info:
Originally Windev started with dates only in string format. Later they added the date type.
Datesys() returns a string, so if you add "1" to it. you will get a concatenation of two strings. As Arie and Dennis stated, you can perform direct calculations on the date type. For the traditional string type date you have to use functions like integertodate.

Regards,
Piet

von Piet van Zanten - am 30.06.2009 19:11
Thank you to all ...(Arie, Dennis, & Piet)

Arie, your first explanation was exactly what I was looking for ...

Dennis, I had no idea you could do anything like that, very efficient

Piet, thanks for the explanation, your explanation about DateSys() being a string help things make sense.

Again, Thank you all for your help!!!

Dan

von Dan M - am 01.07.2009 23:38

Re: How do I calculate a future date?

Just for info, WD initialize most variable types. For a date or an hour
variable, it's initialized to the current date or time.
So "dToday is date = Today()" is equal to "dToday is date"

Rubén Sánchez Peña a écrit :
> Hi Dan. Try
>
> dToday is date = Today()
>
> You can change to other day operating over Day property of variable type
> date:
>
> dToday..Day += 10
>
>
>
> Rubén Sánchez Peña
>
Message forwarded from pcsoft.us.windev

von Goof.pcs.crosspost - am 02.07.2009 09:21

Re: Re: How do I calculate a future date?

Hi,

Yes, that can be tricky sometimes, so don't forget to initialize a date type after declaration to "" if needed.

Regards,
Piet

von Piet van Zanten - am 02.07.2009 13:57
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.