Question

I have a computed field ( Display type: String ):

return currentDocument.getDocument().getCreated()

And I get something like this: 04/23/2014 10:08:08 AM ZE2. Is there any chance I can get off the ZE2 word? I tried changing the Display type to Date/Time but after this the computed field value is empty.

Thanks for your time!

Was it helpful?

Solution

Use .toJavaDate(). So do this instead:

<xp:text escape="true" id="computedField1" 
value="#{javascript:return currentDocument.getDocument().getCreated().toJavaDate()}">
    <xp:this.converter>
        <xp:convertDateTime type="both"></xp:convertDateTime>
    </xp:this.converter>
</xp:text>

Alternatively, use @Created(), so:

<xp:text escape="true" id="computedField1" value="#{javascript:@Created()}">
    <xp:this.converter>
        <xp:convertDateTime type="both"></xp:convertDateTime>
    </xp:this.converter>
</xp:text>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top