Topic Options
#56965 - 04/24/19 04:56 PM Eliminate Seconds display 10:40:00AM = 10:40AM
dstauder Offline
OL User

Registered: 06/28/02
Posts: 74
Loc: St. Louis, Missouri USA

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.

Edited by dstauder (04/24/19 05:17 PM)
Edit Reason: added signature

#56968 - 04/26/19 11:02 AM Re: Eliminate Seconds display 10:40:00AM = 10:40AM [Re: dstauder]
jim3108 Online   content
OL Expert

Registered: 04/19/10
Posts: 295
Loc: London, UK
If you know you always want to lose the seconds, you could simply trim off the part you don't want.

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.