Using the following code in the "calculation" for a multiline text field:
// raw format
var sMsg = Concat("DateTimeField1.rawValue: ", DateTimeField1.rawValue, "\u000a")
// formatted value
sMsg = Concat(sMsg, "DateTimeField1.formattedValue: ", DateTimeField1.formattedValue, "\u000a")
// replace "-" with null
var sDate = Replace(DateTimeField1.formattedValue, "-", "")
sMsg = Concat(sMsg, "Using - Replace(DateTimeField1.formattedValue, '-', ''): ", sDate, "\u000a")
// Date2Num() and Num2Date reformat
sDate = Num2Date( Date2Num(DateTimeField1.formattedValue, "YYYY-MM-DD"), "YYYYMMDD")
sMsg = Concat(sMsg, "Using - Num2Date(Date2Num(DateTimeField1.formattedValue, 'YYYY-MM-DD'), 'YYYYMMDD'): ", sDate, "\u000a")
sMsg
Produces the following result when a date is selected in the DateTimeField1:
DateTimeField1.rawValue: 2008-11-04
DateTimeField1.formattedValue: 2008-11-04
Using - Replace(DateTimeField1.formattedValue, '-', ''): 20081104
Using - Num2Date(Date2Num(DateTimeField1.formattedValue, 'YYYY-MM-DD'), 'YYYYMMDD'): 20081104