Converteer json (facebook) datetimestring to openedge datetime / datetime-tz

/* convert json (facebook) datetimestring to progress datetime-tz */
            
function string2datetimetz RETURNS datetime-tz (INPUT cString AS CHAR):
  /* 2012-11-09T23:00:00+0100 gekopieerd van fb_slurp */
  
  def var dDateTimeTz as datetime-tz no-undo. 
  def var cTmp as char  no-undo.
  def var dDate as date no-undo.
  def var ms as int     no-undo.
  def var tz as int     no-undo.
  def var j  as int     no-undo.
  
  cTmp = cString.
  if ctmp <> ''  /* 2012-11-09T23:00:00+0100 met de hand converteren, progress kent wel iso-date, maar geen weg terug :( */
  then do:
    assign dDate = ?
           ms    = 0
           tz    = 0.
               
    dDate = date( int( substring( cTmp,6,2) ),  int( substring( cTmp,9,2) ), int( substring( cTmp,1,4) ) ) no-error.
    j = index( ctmp, 'T' ).
    if j > 0 
    then cTmp = substring( cTmp, J + 1 ).
    else assign cTmp = ''
                dDatetimetz = datetime-tz( ddate, 0 ).

        
    if ctmp > '' /* 23:00:00+0100 */
    then do:
      ms = int( substring( cTmp, 1, 2 )) * 60 * 60 * 1000.
      ms = ms + int( substring( cTmp, 4, 2 )) * 60 * 1000.
      ms = ms + int( substring( cTmp, 7, 2 )) * 1000.
    
      if length(cTmp) > 8
      then do:
        cTmp = substring( ctmp, 9 ).
        tz = int( cTmp ) * 60.
		
		/* tz kan neg en pos zijn */
        if tz <> 0 then tz = tz / 100.
      end.
         
      dDatetimetz = datetime-tz( ddate, ms, tz ) no-error.
	     
      
    end.
  end.
  return dDateTimeTz.
end.

def var dDatetime as datetime no-undo.
def var dDateTimeTz as datetime-tz no-undo. 
def var cStart as char no-undo.

cStart = '2015-12-04T23:00:00+0000'.

dDatetimeTZ = string2datetimetz( cStart ).
dDateTime = string2datetimetz(CSTART ) .


message dDateTime   skip
    dDatetimeTZ
    view-as alert-box.