You need to sign in to do that
Don't have an account?
Collen Mayer 6
Input time on Visual Force Page
Hi All,
I have a object called "time_entry__c" that includes the following fields: date__c, time_in__c, time_out__c. The date field is date format, and the time in/out fields are date/time format (though if there was a better format option for these fields, they wouldn't have to be date/time). For a timesheet visual force page I'm creating, for the time_in and time_out I'd like to have the user input the time (in time format, 12:00) and use the date from the date field in what is saved in the date/time format. Can anyone point me in the right direction, or suggest an easier way that the user can enter time in a visual force page?
Thanks,
Collen
I have a object called "time_entry__c" that includes the following fields: date__c, time_in__c, time_out__c. The date field is date format, and the time in/out fields are date/time format (though if there was a better format option for these fields, they wouldn't have to be date/time). For a timesheet visual force page I'm creating, for the time_in and time_out I'd like to have the user input the time (in time format, 12:00) and use the date from the date field in what is saved in the date/time format. Can anyone point me in the right direction, or suggest an easier way that the user can enter time in a visual force page?
Thanks,
Collen
There is a Time Class in Apex that you can use. See example below for how to get the current time displayed in the HTML 5 time input field
Apex Controller: Visual Force Page: Output:
Note: input tags may not be supported on all browsers. It would be advisable to check a service such as CanIUse to make sure that your target browser supports it.
Please let us know if this helps.
Thanks,
Nagendra
I need to use the input tag with type time instead of the following, which I normally use: (TSE.Time_in_1__c is a datetime field).
Thanks for any code suggestions.
Best,
Collen