Posted Tue, 01 Jun 2021 02:28:19 GMT by

I have created a variable, and I would like to load it with current date and time (or timestamp).

name:  $v{datetime}

  • variable class type:  java.sql.Timestamp
  • Calculation Type:  System

Variable Expression

  • date() --> error: command not found
  • timestamp() --> error: command not found

any help would be greatly appreciated 

Posted Tue, 01 Jun 2021 03:22:37 GMT by

I got the following to work (kind of)

name:  $v{datetime}

  • variable class type:  java.util.Date
  • Calculation Type:  System

Variable Expression

  • new Date()

 

printed the following --> 31/05/21 3:19 PM

===========================================

Can you please tell me how to change it to the format yyyy-mm-dd hh:mm:ss

Posted Tue, 01 Jun 2021 23:19:57 GMT by

Hello Della,

I'd recommend just using the new Date() function within a field element.

Under the field's Properties > Text Field tab:

Set the Text Field Expression class to java.util.Date

Set the Pattern to: yyyy-MM-dd hh:mm:ss

Set the Text Field Expression to newDate()

Thanks!

Albert

You must be signed in to post in this forum.