Reformating time and changing time

i am pulling scheduling times from a report for entry into a salesforce field

the times listed in the report are in military times in 15 min increments and the salesforce entry options are in standard time with 30min increments.

report time looks like 14:45 or 15:15
options on the website are like 11:30 am or 7:00pm

I’ve been given the go ahead to alter the 15 min increments to half hours.

what is the most efficient way to alter the report time to match the website format? website field can have information directly typed in or chosen from a dropdown


1 Like

Good morning Jason,

It looks like you’d be able to use an If activity to determine if the first 2 values are greater than or less than 12. If it’s greater than 12, subtract 12 from the first digit and append PM to the end of the time. Otherwise, leave the time and append AM to end of the time.

For the second half, I would use a similar function. If the last two digits are 15, replace it with 30.


dang. i was really hoping there was some formatting or method wizardry i was missing to make this easier to do.


@Jason_Dossett yes there is some formatting and method wizardry you could do instead.

First step is to convert your string into a system.DateTime variable. Use this with Datetime.ParseExact method. So in an assign activity put ReportTime = Datetime.ParseExact(TimeAsString,"HH:mm"System.Globalization.CultureInfo.InvariantCulture)

Now in the website, you want to enter it in a different string format, so at the point where you are typing in the text, you want to put write text = ReportTime.ToString(“hh:mm tt”)

NOTE: I am unsure if there is a space between am/pm as it was inconsistent. I also am assuming hours and minutes are in the HH/hh and mm, meaning 8:03 am is displayed 08:03 am instead of 8:3 am

As for the 15 minute increments, do you always round up? If so, after grabbing ReportTime, you should add an if statement. If ReportTime.ToString(“mm”) like “?5” Then Assign ReportTime = ReportTime.AddMinutes(15) Else (leave this side blank)

i will give that a try


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.