Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: robertpp am 14.04.03 - 11:03:23
-
Ich habe in FS ein Code der lautet:
SetField("difdate";(ArchEndTime-@Today)/86400);
Das liefert mir eine ganze Zahl zurück wie viele Tag zwischen den Tagen liegen. das auch richtig ist.
Das ganze wollte ich mir jetzt im LS-Sprache auch basteln nur bekomm ich da immer ein Zahl mit dezimalstellen. Ich habs mal so probiert :
doc.difdate=(doc.ArchEndTime(0)-Today())/86400
oder
doc.difdate=(doc.ArchEndTime(0)-Date)/86400
bitte um hilfe robertpp
-
Martin Scott / http://www.martinscott.com/DesignLibrary.nsf/scategory/B86B846410A8922985256C08001DF55E?opendocument :
'doc is a notesdocument to find difference in days between say today
'and another date say doc.created i.e the date of creation of the
'document
daydiff=abs(int(Cbdl(Today)-Cbdl(doc.created)))
'would do "Cbdl" is used to get the double numeric format of the dates
'the decimal part which is time is removed by using "Int" and "Abs"
'returns absolute value
oder Ata´s Datehandling DB:
http://www.anton-tauscher.de/Download/DateHandling.zip
-
wo ist das ganze in ata seiner DB?
robertpp
-
wenn mich nicht alles taeuscht, in einer Script-Bibliothek...
gruss
-
Ich komm leider zu keiner lösung ich hab auch schon einiges ausprobiert ich weiß aber nicht ob das überhaupt so funken kann!
' doc.difdate=Abs(Int(Cdbl(doc.EndTime)-Cdbl(Date)))/86400
' doc.difdate=(Day(doc.EndTime)-Date)/86400
' doc.difdate=(Datevalue(doc.EndTime)-Date)/86400
' doc.difdate=Abs((doc.EndTime(0)-Date)/86400)
das EndTime-Feld ist ein Datumsfeld!!
kann mir wer weiter helfen!
robertpp
-
hab das in einen Button reingehauen und 2 Felder Date1/Date2...
Dim NWS As New NotesUIWorkspace
Dim UIDoc As NotesUIDocument
Set UIDoc = NWS.currentdocument
Dim Doc As NotesDocument
Set Doc = UIDoc.document
daydiff=Abs(Int(Cdbl(doc.Date1(0))-Cdbl(doc.Date2(0))))
Msgbox Cstr(daydiff)
Klappt wunderbar...war übrigens oben ein Schreibfehler aus Martin Scotts Codelib...statt "Cbdl" heißt es "Cdbl"
-
Bei mir klappt es jetzt auch!!!
danke
robertpp
-
... falls du noch Interesse an der Lib hast...
http://www.anton-tauscher.de/downloads/DateHandling.nsf (http://www.anton-tauscher.de/downloads/DateHandling.nsf)
http://www.anton-tauscher.de/downloads/DateHandling.zip (http://www.anton-tauscher.de/downloads/DateHandling.zip)
ata
-
danke @ata
Ich hab sie mir eh schon vor längeren heruntergesaugt aber ich hab nicht gewusst wo ich in der db das finden kann!!
robertpp
-
... die Lib liegt bei Resourcen unter Libraries
... eingebunden wird sie, indem du die Lib bei dir einfügst, und dort wo du sie benötigst mit Use "Datehandling" einbindest. Ab dann gehst du mit der Lib so um, wie ich es in der Beispielmaske demonstriere...
ata