Page tree
Skip to end of metadata
Go to start of metadata

The pjs.timestamp() API converts an expression to a timestamp, or returns the current date & time as a timestamp if no parameters are passed to it. 


  • Field or expression (optional)
  • Format or Fractional seconds (optional) - format can be *iso or *iso0
  • Fractional seconds (optional)

Return Value

A timestamp value

RPG Equivalent


What's the difference between *iso and *iso0?

*iso is the default timestamp format. *iso0 is for indicating there are no separators in the timestamp.


pjs.define("Kstamp", { type: 'timestamp', initValue: pjs.timestamp('2019-12-31-') });
timest = pjs.timestamp('1960-09-29-', "*iso");
data = pjs.char(timest);

More Examples

If you need to convert a string with a date value in it, you need to use this in conjunction with pjs.toDate(). Below is an example: 

timest = pjs.timestamp(pjs.toDate('2001-03-05'));   //The date string value is converted to a date first, and then to a timestamp.