Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

24hr time format in formula

Status
Not open for further replies.

jkupov

Technical User
Apr 28, 2004
101
US
I have a report in which I need to round timestamps to the half hour so that anything between 00 minutes and 29 minutes round to the hour and anything between 30 and 59 minutes round to the half hour. So, for instance, 12:00 - 12:29 are in the 12:00 time slot, and 12:30-12:59 are in the 12:30 time slot.

I think I have a good start and it is displaying correctly . . . for the most part. My problem is that it is not differentiating between AM and PM. So both 1AM and 1 PM are displayed as 01:00. I want them to display in the 24 hour format so that 1AM = 01:00 and 1PM = 13:00. Here is my formula so far. What am I missing?

WhilePrintingRecords;
timeVar tempTime := {service_req.appt_time};

If minute(tempTime) >= 30 then
tempTime := time(Hour(tempTime),30,0)
else
tempTime := time(Hour(tempTime),0,0);

totext(temptime,"hh:mm");

 
Change the lat line of your formula to:

totext(temptime,"HH:mm");


Cheers
Pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top