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
BobPBobP 

I have a formula field with a formula that is showing the incorrect time.

I have a date and time field that i am trying to just get the time from the that field. When I use this below format it gives me the time 5 hours ahead of EST. so the time in the field is 12:00pm it displays 5:00PM
(TIMEVALUE(SchedStartTime)

I guess i need to add the time zone to this formula on my time formula field but I am not sure how
VinayVinay (Salesforce Developers) 
Hi Bob,

The datetime in salesforce is always stored in GMT (UTC).  You can try something like below.
TIMEVALUE(NOW()- 5/24)
Check below references.

https://developer.salesforce.com/docs/atlas.en-us.formula_date_time_tipsheet.meta/formula_date_time_tipsheet/formula_using_date_datetime.htm
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8cuYSAR

Please mark as Best Answer if above information was helpful.

Thanks,
BobPBobP
Hello Viney,

I found a formula that mostly works below but when there is a 12:00PM value in the schedule start date field, it shows as 12:00AM in my formula field. Have you ever seen this issue before?
User-added image
IF( OR(
SchedStartTime< DATETIMEVALUE(DATE(YEAR(DATEVALUE(SchedStartTime)),3,14)
-(WEEKDAY(DATE(YEAR(DATEVALUE(SchedStartTime)),3,14))-1))+11/24,
SchedStartTime> DATETIMEVALUE(DATE(YEAR(DATEVALUE(SchedStartTime)),11,7)
-(WEEKDAY(DATE(YEAR(DATEVALUE(SchedStartTime)),11,7))-1))+11/24
),
TEXT(
HOUR(TIMEVALUE(SchedStartTime-5/24))
-IF(HOUR(TIMEVALUE(SchedStartTime-5/24))>23,24,0)-
IF(HOUR(TIMEVALUE(SchedStartTime-5/24))
-IF(HOUR(TIMEVALUE(SchedStartTime-5/24))>23,24,0)>12, 12,0))+":"+
LPAD(TEXT(MINUTE( TIMEVALUE(SchedStartTime  ))),2, "0")+
IF(HOUR(TIMEVALUE(SchedStartTime-5/24))
-IF(HOUR(TIMEVALUE(SchedStartTime-5/24))>23,24,0)>12, " P"," A")
,
TEXT(
HOUR(TIMEVALUE(SchedStartTime-4/24))
-IF(HOUR(TIMEVALUE(SchedStartTime-4/24))>23,24,0)-
IF(HOUR(TIMEVALUE(SchedStartTime-4/24))
-IF(HOUR(TIMEVALUE(SchedStartTime-4/24))>23,24,0)>12,12,0))

+":"+
LPAD(TEXT(MINUTE( TIMEVALUE(SchedStartTime ))),2, "0")+
IF(HOUR(TIMEVALUE(SchedStartTime-4/24))
-IF(HOUR(TIMEVALUE(SchedStartTime-4/24))>23,24,0)>12, " P"," A")

)
+"M"