The documentation on the data extension data types reads:
Date
- A system date
- You can use an AMPscript function to format this value when you present it in a message
- Attributes of a date type will accept dates in various formats, such as 1/1/2005 or January 1, 2005
- All dates are stored in the format MM/DD/YYYY, and if a date is entered in a different format, the system will convert it to the
proper format when storing it
- Valid date values begin after 12/31/1772 and before 01/01/10000
- You can add a HH:MM time value following the date value, such as 12/12/2012 12:12 PM.
As long as your data extension uses the data format for the column, and your string is in the proper format according to the above guidelines, you should be ok.
It appears that we do not, however, store as a 24-hour time (which btw is not GMT per se, unless you are not using a timezone offset). A simple fix for this would be to check for AM/PM and add 12 when parsing from the DE, and check for >12 and modify when going back to the DE to store.
To use Concat()
to pull individual items together, the string would have to match the above valid date format.
CONCAT(@month,"/",@day,"/",@year," ",@hour,":",@minute," ",@ampm)
This will produce a valid string, especially when using DatePart()
, since it returns a string of the segment you requested.
You are correct - Looking at the SFDC Object reference, Case.closedDate
is a DateTime field so line 2 and line 4 will break
Looking at line 2 and line 4 - these are manipulating days, not seconds so I'd rewrite line 2 and line 4 as:
Line 2
( 5 * FLOOR( ( DATEVALUE(ClosedDate) - DATE( 1900, 1, 8) ) / 7) +
Line 4
MOD( DATEVALUE(ClosedDate) - DATE( 1900, 1, 8), 7) +
You should go to the doc and use the feedback form to point this out to SFDC
Best Answer
Yes it is possible with a formula field. Create two text fields
Text1
andText2
where times are saved in form11:30:00
(hour:minutes:seconds). Then create a new formula field of typeNumber
with two decimal places:This formula uses these times and created two datetime values from it. And then just calculated the duration: