Eliminate Seconds display 10:40:00AM = 10:40AM

Posted by: dstauder

Eliminate Seconds display 10:40:00AM = 10:40AM - 04/24/19 04:56 PM

Hello,

I have a script that is subtracting 20 minutes from an appointment time (11:00AM - 20 minutes = 10:40AM). PlanetPress is padding with seconds as well (10:40:00AM). I want to display without seconds.

Here is the script:

dim Time
dim ArrTime

Time =Watch.getvariable("global.ApptTime")
ArrTime =DateAdd("n",-20,Time)

Watch.SetJobInfo(8), ArrTime



Thank you in advance for your assistance.
Dan
Posted by: jim3108

Re: Eliminate Seconds display 10:40:00AM = 10:40AM - 04/26/19 11:02 AM

If you know you always want to lose the seconds, you could simply trim off the part you don't want.

Code:
ArrTime = Replace(ArrTime, ":00AM", "AM")
ArrTime = Replace(ArrTime, ":00PM", "PM")


There are various ways, you could even trim from the right 5 chars and then add back the AM/PM notation. Or use mid to select from/to to trim but the above should work.

Let me know if this helps.

J