Our organization time zone is pst. And user timezone is also pst. So, I need the records created between 4:31 PM pst to 4:29 AM pst.

I tried to create a formula field like this. And it's showing hours now But I am unable to figure out how to setup minutes & filter only records created under this duration

My Formula:

VALUE(MID (TEXT (CreatedDate -7/24),12,2))

  • Can you give us more detail? If you're trying to run a SoQL, why create a formula field? What exactly are you trying to do? – Sebastian Kessel Nov 2 '18 at 17:11
  • No, I'm trying to do it from standard reporting. So, I am trying to create formula field in sfdc any possibility? – Pavan tej Nov 5 '18 at 12:27

You can use a Formula Date/Time field with this formula:

CreatedDate - ((NUM_OF_HOURS * 60)/1440)
  • Could you please explain the formula & specifically Num_of_hours in the sense – Pavan tej Nov 2 '18 at 16:06
  • In your formula you tried to subtract 7 hours from the createddate field: You have to create a formula Date/Time Field and not a text. You can use this formula too: CreatedDate - (7/24) you can reduce the 60/1440 = 24, which is the number of hours a day. – Mo Hamada Nov 2 '18 at 16:18
  • Here is a link: help.salesforce.com/articleView?id=000221466&type=1 – Mo Hamada Nov 2 '18 at 16:21
  • My formula is working perfectly with hours because i'm subtracting users timezone only.But the problem with minutes here – Pavan tej Nov 2 '18 at 16:21
  • As I said, try to use a Date/Time field instead of Text – Mo Hamada Nov 2 '18 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.