Jump to content
Server Maintenance This Week. ×

This topic is 8054 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm trying to get text, date, and time fields into a text single. Everything works fine, but I want time displayed as "hh:mm AM/PM", it comes out in 24 hour notation w/o AM or PM. Does anyone know how to get 12 hour notation?

-Heather

Link to comment
Share on other sites

Heather,

Use this calculation for the text of a field called "Time":

code:


if(Hour(Time) > 12, Hour(Time)-12&":"&Right("00"&Minute(Time),2)&"PM",Hour(Time)&":"&Right("00"&Minute(Time),2)&"AM")

This will give you single hour figures for hours less than 10. IF you want a leading zero for the hours then use:

code:


if(Hour(Time) > 12, Right("00"&Hour(Time)-12,2)&":"&Right("00"&Minute(Time),2)&"PM",Right("00"&Hour(Time),2)&":"&Right("00"&Minute(Time),2)&"AM")

You can include this if statement in the middle of whatever else you are using to produce your final text string.

Russ

[ April 08, 2002, 07:38 PM: Message edited by: Russell Baker ]

Link to comment
Share on other sites

This topic is 8054 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.