function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DannyK89DannyK89 

Display Hour and Minutes in Text field

I have been trying and searching for a while and I can't seem to find a way to display the Time specificly the hour and minutes from and Date time field. I would like to display the Hour and Minute from the NOW() function in salesforce formula editor. If anyone can give me some tips that would be great. Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Noam DganiNoam Dgani

LEFT(RIGHT(TEXT(NOW()), 10),6)

All Answers

raj123raj123

DateTime dt=System.now();
String str=dt.format('HHMMSS');

Noam DganiNoam Dgani

LEFT(RIGHT(TEXT(NOW()), 10),6)

This was selected as the best answer
PrAnKPrAnK

can any one give me solution of that previous query

T-HanT-Han

Hope you figured it by now. Still

 

Left - 10, Right -6,

 

now() - 2013-03-05 06:53:43Z

After 10th digit from right points to 06

&& 6th digit to 53

 

Hence the time 06:53