The following steps are based on the above example,
1. add custom datetime format
add following line to the end of cluster wide property datetime.customFormats,
dd/MMM/yyyy HH:mm
(NOTE: only the last line doesn't require semicolon";", so you should add ; to the end of the line before last line)
<Please see attached file for image>

2. set context variable as datetime
Date type: Date/Time
Date Format: dd/MMM/yyyy HH:mm (select the new format from the dropdown list)
Expression: 13/Jul/2018 10:30 (you can use a string variable instead)
<Please see attached file for image>

3. formatting output
${<your datetime variable>.yyyy-MM-dd'T'HH:mm:ss}
<Please see attached file for image>

sample policies, (copy the xml and paste to you policy window)
<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
<wsp:All wsp:Usage="Required">
<L7p:SetVariable>
<L7p:Base64Expression stringValue="MTMvSnVsLzIwMTggMTA6MzA="/>
<L7p:VariableToSet stringValue="orgdatestring"/>
</L7p:SetVariable>
<L7p:SetVariable>
<L7p:Base64Expression stringValue="JHtvcmdkYXRlc3RyaW5nfQ=="/>
<L7p:DataType variableDataType="dateTime"/>
<L7p:DateFormat stringValue="dd/MMM/yyyy HH:mm"/>
<L7p:DateOffsetExpression stringValue=""/>
<L7p:VariableToSet stringValue="newdate"/>
</L7p:SetVariable>
<L7p:HardcodedResponse>
<L7p:Base64ResponseBody stringValue="b2xkIGRhdGU6ICR7b3JnZGF0ZXN0cmluZ30KbmV3IGRhdGU6ICR7bmV3ZGF0ZS55eXl5LU1NLWRkJ1QnSEg6bW06c3N9"/>
<L7p:ResponseContentType stringValue="text/plain; charset=UTF-8"/>
</L7p:HardcodedResponse>
</wsp:All>
</wsp:Policy>