In this blog lets see how we can get the time entered in the date and time field and format it in hours and minutes format.
I have created a field in CRM with field type Date and time. Here is how it looks
This code gets the date and time (hours and minutes) selected in the date field and will format the hour and minutes in the format “HH:MM“.
Hour – (getHour())
Minutes – (getMinutes())
Note : You can also add the AM / PM to the time string I have not added it in my time string “strTime” but have stored the value of it in “ampm“.
Hope this helps !