AppleScript: How to get time without seconds? Alternatively, how to remove text in middle of string? If you use the following code:

set CurrentTime to (time string of (current date))


The CurrentTime will be set in the following format:

12:02:38 PM


However, I want CurrentTime to be:

12:02 PM


So, I want to remove the characters in the 6, 7, and 8 positions in the string.

How can this be accomplished in AppleScript? Thank you.
Here is an AppleScript subroutine I found doing a Google search that does what you asked.

on getTimeInHoursAndMinutes()
    -- Get the "hour"
    set timeStr to time string of (current date)
    set Pos to offset of ":" in timeStr
    set theHour to characters 1 thru (Pos - 1) of timeStr as string
    set timeStr to characters (Pos + 1) through end of timeStr as string

    -- Get the "minute"
    set Pos to offset of ":" in timeStr
    set theMin to characters 1 thru (Pos - 1) of timeStr as string
    set timeStr to characters (Pos + 1) through end of timeStr as string

    --Get "AM or PM"
    set Pos to offset of " " in timeStr
    set theSfx to characters (Pos + 1) through end of timeStr as string

    return (theHour &amp; ":" &amp; theMin &amp; " " &amp; theSfx) as string
end getTimeInHoursAndMinutes

set CurrentTime to getTimeInHoursAndMinutes()