0
votes

I can not believe how simple this should be but it is just not working for me. I have a data table. I have a computed field for one of the columns of that data table.

<xp:text escape="true" id="computedField1">
<xp:this.value><![CDATA[#{javascript:var doc:NotesDocument = database.getDocumentByUNID(rowData);return doc.getItemValueDateTimeArray("FormCreated")[0];}]]></xp:this.value>    
<xp:this.converter><xp:convertDateTime type="both" dateStyle="short"timeStyle="short"></xp:convertDateTime></xp:this.converter>
</xp:text>

This does not display a value for the date field. If I prepend doc.getItemValueDateTimeArray("FormCreated")[0] with "0" + to make it

"" + doc.getItemValueDateTimeArray("FormCreated")[0]

Then the date shows but not in the format I have selected for the field. I am guessing the "" + is converting the date to a string. How do I display this date / time in the format that I want?

1

1 Answers

4
votes

You could use SimpleDateFormat like this

var dt:NotesDateTime=doc.getItemValueDateTimeArray("FormCreated")[0]
var jdate=dt.toJavaDate()
var Pattern = new java.text.SimpleDateFormat("Date pattern you want to display");
var retstring=Pattern.format( jdate )
dt.recycle()

The info on the pattern format can be found here SimpleDateFormat Documentation