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
bhanu pbhanu p 

I Need to capture record created time into another field.

Ideally I'd store the hour in a formula field (10:23 = 10 and 3:49 = 13, etc.)
I Have a field like opportunity_hour, in this field i need to capture record created time into another field?User-added image
Ideally I'd store the hour in a formula field (10:09 = 10 and 3:36 = 15, etc.)
Thoughts on how best to do this?
Thanks,
Ajay Ghuge 6Ajay Ghuge 6
Hi Bhanu ,

Check the following blog it will help you to extract hour from datetime field.
http://codewithajay.blogspot.in/2016/03/extension-to-datetime-formula-SFDC.html

You can also check these formulas :
http://resources.docs.salesforce.com/200/13/en-us/sfdc/pdf/salesforce_useful_formula_fields.pdf

Check page number 18
 
Regards,
Ajay
Mahesh DMahesh D
Hi Bhanu,

Please find the below formula to provide the time.

LEFT(RIGHT(text( CreatedDate ),9),2)

It will display in GMT time zone, you may need to convert it accordingly.

Regards,
Mahesh
AG_SFDCAG_SFDC
Hello Bhanu,

Please refer to: https://help.salesforce.com/HTViewSolution?id=000181642&language=en_US

And try this:
 
LEFT(RIGHT(
IF ( DATEVALUE(CreatedDate) >=
DATE ( YEAR (DATEVALUE(CreatedDate)),3,1)
+
(
14-
CASE( MOD(DATE ( YEAR (DATEVALUE(CreatedDate)),3,1) - DATE (1900,1,7),7) ,
0,7,MOD(DATE ( YEAR (DATEVALUE(CreatedDate)),3,1) - DATE (1900,1,7),7))
)
&&
DATEVALUE(CreatedDate) <
DATE ( YEAR (DATEVALUE(CreatedDate)),11,1)
+
(
7-
CASE( MOD(DATE ( YEAR (DATEVALUE(CreatedDate)),11,1) - DATE (1900,1,7),7) ,
0,7,MOD(DATE ( YEAR (DATEVALUE(CreatedDate)),11,1) - DATE (1900,1,7),7))
),
LEFT ( TEXT (CreatedDate- 7/24 ), 16),
LEFT ( TEXT (CreatedDate- 8/24), 16)
),5),2)
This should automatically adjust to the timezone.

Thanks,
AG