Page 1 of 1 1
Topic Options
#147301 - 2005-09-07 10:17 PM DateAdd Problem
Darkwin Offline
Fresh Scripter

Registered: 2003-01-04
Posts: 12
Loc: Assen, The Netherlands
I have a problem to add a nummer to the date.

sample:
7-09-2005 + 4 = 11-09-2005

my code is
Code:
$1 = 7 - @WDayNo

$ZatDay = @DATE + $1

? $ZatDay



Edited by Darkwin (2005-09-07 10:18 PM)

Top
#147302 - 2005-09-07 10:23 PM Re: DateAdd Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, the date is string. adding a number to it just makes that string longer.
look into the UDF library for date calculation UDF's
_________________________
!

download KiXnet

Top
#147303 - 2005-09-07 10:40 PM Re: DateAdd Problem
Darkwin Offline
Fresh Scripter

Registered: 2003-01-04
Posts: 12
Loc: Assen, The Netherlands
I have a VBS code and want to convert it to kix

this is de VBS code
Code:

Dim datum, MyWeekDay, NewDate

datum = Date

MyWeekDay = WeekDay(Datum)

WScript.Echo "WeekDay: " & MyWeekDay

ZatDat = DateAdd("d", 7 - WeekDay(Datum), Datum)

WScript.Echo "DateAdd: " & ZatDat



Top
#147304 - 2005-09-07 10:45 PM Re: DateAdd Problem
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Why, when there are ready made UDFs?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#147305 - 2005-09-07 10:49 PM Re: DateAdd Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you have this dateAdd() code?
_________________________
!

download KiXnet

Top
#147306 - 2005-09-07 10:54 PM Re: DateAdd Problem
Darkwin Offline
Fresh Scripter

Registered: 2003-01-04
Posts: 12
Loc: Assen, The Netherlands
Yes, I have it in VB but not in kix.
Top
#147307 - 2005-09-09 05:32 AM Re: DateAdd Problem
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Ten use the VB-2-KIX UDF to convert if the existing UDFs are not good enough for you.
_________________________
There are two types of vessels, submarines and targets.

Top
#147308 - 2005-09-09 11:17 AM Re: DateAdd Problem
Darkwin Offline
Fresh Scripter

Registered: 2003-01-04
Posts: 12
Loc: Assen, The Netherlands
i am looking in the udf forum.
but i can't find the function.

can anybody help me?

thinks.

Top
#147309 - 2005-09-09 11:33 AM Re: DateAdd Problem
CJPinder Offline
Lurker

Registered: 2005-09-08
Posts: 4
I think the UDF you need is SerialDate. Use it to convert your date into a number, add to it the required number of days and then use SerialDate again to convert the number back into a date string.

Regards,
Christian.

Top
#147310 - 2005-09-09 11:47 AM Re: DateAdd Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and instead of searching, just open www.kixtart.org/UDF in your browser and select it from the list.
_________________________
!

download KiXnet

Top
#147311 - 2005-09-09 11:56 AM Re: DateAdd Problem
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Dateadd UDF is not there Just checked and no dateadd exists in the list.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#147312 - 2005-09-09 12:01 PM Re: DateAdd Problem
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no, dateadd() is not there yet as he didn't place it there yet.
but serialdate is.
_________________________
!

download KiXnet

Top
#147313 - 2005-09-09 02:13 PM Re: DateAdd Problem
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
I'd suggest DateCalc() by Jochen, or my new one in the Scripts Forum fnDateDiff(). If you need to calculate the weekday of a past or future day you may want to look at fnWeekDay() in the Scripts Forum too.
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.059 seconds in which 0.021 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org