A quick and dirty way for doing this. No error checking, big assumptions about the input to the prompt being right.
1 2 3 4 5 | nd := @Prompt([OKCANCELEDIT]; "Enter the New Date"; "YYYY/MM/DD."; @Today); @If (nd ="";@Return("");""); y := @Left (nd;"/"); m := @Left(@Right (nd;"/");"/"); d:= @right(@Right (nd;"/");"/"); |
1 2 | FIELD DateFieldOnForm := @Date(@TextToNumber (y) ;@TextToNumber ( m) ;@TextToNumber ( d) ) |
the Key is parsing the string with @lefts and such, and then TextTonumber, to put humpty Dumpty back together again. The @Date means it is a Date field on the document, not a text string.
The better, clean, way would be to use LotusScript and open a form in Dialog box mode, the form having a Calander tool on it.
You could always use tmp := @Explode(nd;”/”) and then subscripts on the tmp variable to make the code alittle more compact.
Sean—
I’m trying to use my own code and your code but neither seem to work in Domino 7. The @Today part is not working. Any ideas?
FIELD date :=(@Prompt([OkCancelEdit]; “Enter implementation date”; “Format: MM/DD/YYYY. Ex: 10/01/2007”; @Today));
and
nd := @Prompt([OKCANCELEDIT]; “Enter the New Date”; “YYYY/MM/DD.”; @Today);
@If (nd =””;@Return(“”);””);
y := @Left (nd;”/”);
m := @Left(@Right (nd;”/”);”/”);
d:= @right(@Right (nd;”/”);”/”);
make @today into @Text(@Today)
Just what I was looking for. Still useful 11 yrs down the line.