CTime({ado.x}) returning "12:00 AM" for all {ado.x}.  The CTime function takes number or string arguments.  My argument is an integer that can range from 0 to 2399.  No matter what the integer value, CTime is returning "12:00 AM"!  This doesn't do what I think it should do.  All I want is for it to return the time on a 12-hour clock.

By the way...

I checked Format Field and the sample at the bottom of the Date/Time tab is the correct time format I desire.

I've also IsTime({ado.x}) and it's returned True.

###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Where are you using this function?

What version of Crystal?

mlmcc
0
Author Commented:
In a formula in my Crystal report.  Version 8.5.
0
Commented:
Can you provide some sample values for {ado.x}?

GusDarino
0
Author Commented:
They range from 0 to 2359.  Like, 930, 1100, 1415, 2130.
0
Commented:
Try this:

0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Perfect!
0
Commented:
OK that makes more sense now.  You originally listed 0 to 2359.

I am assuming then that:

930 = 9:30 am
1100 = 11:00 am
1415 = 2:15 pm
2130 = 9:30 pm

I assume that whole hours such as 1:00 pm are listed as 1300 and 9:00 am as 900.
The integer stores time in military format with hours and minutes only.

If my assumptions are correct then you can do the following:
Create a formula as follows:

Put the formula in the report and it should give you what you are looking for.  I am sure there are other ways of getting the same results.  This is just what came to mind.

GusDarino
0
Author Commented:
Your assumptions are correct.  And I did mistakenly say 2399 instead of 2359 in my original post.  I've accepted bdreed35's answer.  Thanks.
0
Commented:
NP, I did not refresh my browser before posting.  :-)  His answer is much better.

GusDarino
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.