Bruce Stemplewski
Bruce Stemplewski

Reputation: 1343

Why do I need to use @Text to display a date field?

I have a computed field with the following formula.

var time = "";
if(@IsNewDoc()==1) time = @Now();
else time = @Text(@GetField("FormCreated"));
return time;

The only wy I could get this to work is to wrap the @GetField("FormCreated") with @Text. The computed field is set as DateTime and FormCreated is an actual date/time value in the document.

Why does @Now not need @Text?

Upvotes: 0

Views: 1101

Answers (1)

Fredrik Norling
Fredrik Norling

Reputation: 3484

When you use @GetField you will get a NotesDateTime and @Now returns a java date. try this code

var time = "";
if(@IsNewDoc()==1){
 time = @Now();
}else{
var time2:NotesDateTime = @GetField("FormCreated")[0];
time=time2.toJavaDate();
}
return time;

Updated the code and added [0] at the end of the @GetField row to get the first entry from the returned vector.

Upvotes: 3

Related Questions