+ Start a Discussion
Amer SkroboAmer Skrobo 

How to format Time data type to choose only minutes

Is there way to format Time data type in inputfield,  so when I choose time it gives me hourd and minutes but I want only minutes.
SandhyaSandhya (Salesforce Developers) 

If you are using formaula field then you can use MINUTE function.

In Apex use below code
Time myTime = Time.newInstance(3, 14, 15, 926);
System.assertEquals(14, myTime.minute());
Refer below links for more information.

Please mark it as solved if my reply was helpful, it will make it available
for others as a proper solution.

Best Regards,

Amer SkroboAmer Skrobo
Maybe I didn't explain enough well. On page when I select time I want to be able to choose only minutes not hours and minutes.

Example if you want to be able to set how many time one exam takes place in minutes
SandhyaSandhya (Salesforce Developers) 

Salesforce Time field will support only below formats

hh:mm:ss aa10:30:25 AM
hh:mm:ss.SSS a10:30:25.125 AM
HH:mm:ss.SSSZ14:30:25.125Z displays as GMT
hh:mm a10:30 AM
h a4 PM
H:mm1:23 is 1:23 AM
H14 is 2:00 PM
Hmm123 is 1:23 AM
HHmm1434 is 2:34 PM

So you may need to create custom page.

Best Regards,
Amer SkroboAmer Skrobo
Do you have idea how to code it??
Glyn Anderson (Slalom)Glyn Anderson (Slalom)
Amer,  Why don't you use an Integer field with the number of minutes?  Don't use Time...
Hi Amer Skrobo,
Is it ok if you use a formula field to convert the time into minutes. I did it by creating a new formula field called Minutes with the expression:
(HOUR( time__c ) * 60)  + MINUTE( time__c )

Try this out. If it helps in sorting out your issue,please mark it as solved.