Skip to main content

Does anyone know how to get the ISO 8601 version of a datetime in K2? I am specifically looking for something like 20*personal details removed*T11:25:44Z"

 

I already looked on this page and cannot find this --> https://help.k2.com/onlinehelp/k2blackpearl/userguide/4.7/default.htm#2.Create/K2_for_VisualStudio_K2_Studio/4.Workflow/InlineFunctions/FB_DateTime.htm

 

Any help here would be greatly appreciated.

Hey MrSharePoint,

 

If trying to do this in Smartforms, try setting a Style on the control (and making sure the control is set to a datetime field).

 

You can select Custom inside the Style Builder and you can input the following to create any combination:

     YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)
s = one or more digits representing a decimal fraction of a second
tt = AM/PM

 

 

 

While it looks like the time zone (TZD) and some other values are not currently supported inside of custom styles, this could be mitigated by passing the datetime value as input into a SmartObject which references a SQL stored procedure.  This stored procedure would then return the formatted datetime back as output and you could capture it. 

 

If you did it this way, it would work in both Smartforms or Workflows.


See here for how that procedure might look.

See here for an exhaustive list of available FORMAT conversions you can run in SQL.

 

Hope that helps!


David


Reply