Using a derived field to output time in 24-hour format
Problem or error: How do I output time in 24-hour format (military time) in Campaign?
Solution: To obtain 24-hour time format you can create a derived field in Campaign using the following statement.
if((string_seg(10, 11, Current_Time()) = 'PM' 
AND number(string_seg(1, 2, Current_Time()))< 12) ,
string_concat(format((number(string_seg(1, 2, Current_Time()))+ 12),2),
string_seg(3, 8, Current_Time())),
if ((string_seg(10, 11, Current_Time()) = 'AM'
AND number(string_seg(1, 2, Current_Time())) = 12),
string_concat('00', string_seg(3, 8, Current_Time())),
string_concat(string_seg(1, 2, Current_Time()),
string_seg(3, 8, Current_Time()))))
*
Here is an alternative method that achieves the same result.
StripHour = string_seg(1, 2, Current_time())
HourNum = number(StripHour)
StripPM = string_seg(10, 11, Current_time())
StripRest = string_seg(3, 8, Current_time())
if((StripPM = 'PM' AND HourNum < 12),
string_concat(format((HourNum + 12),2), StripRest),
if ((StripPM = 'AM' AND HourNum = 12), string_concat('00', StripRest),
string_concat(Strip_Hour, StripRest)