Function to return date in format YYYYMMDD

Is there a simple function to return date in format YYYYMMDD. I need to query DB2 and they require that format, i can construct one but its seems overly complicated

...

OriginalPostID-104919

OriginalPostID-104919

  Discussion posts and replies are publicly visible

Parents
  • datetext() works but make sure to test - I believe if you do not convert to GMT it may return 1 day previous to the input. As I have had that issue, I now use this expression in a rule to return YYYYMMDD (with 'dateIn' as a Date type parameter):

    =tostring ( year ( ri!DateIN ) ) & substitute ( padleft ( tostring ( month ( ri!DateIN ) ) , 2 ) , " " , "0" ) & substitute ( padleft ( tostring ( day ( ri!DateIN ) ) , 2 ) , " " , "0" )
Reply
  • datetext() works but make sure to test - I believe if you do not convert to GMT it may return 1 day previous to the input. As I have had that issue, I now use this expression in a rule to return YYYYMMDD (with 'dateIn' as a Date type parameter):

    =tostring ( year ( ri!DateIN ) ) & substitute ( padleft ( tostring ( month ( ri!DateIN ) ) , 2 ) , " " , "0" ) & substitute ( padleft ( tostring ( day ( ri!DateIN ) ) , 2 ) , " " , "0" )
Children
No Data