You need to sign in to do that
Don't have an account?
Bob Sanders
How to convert NOW function into pst timezone in a text field?
Hello,
So I'm trying to convert the NOW function into pst time zone with the date format of "mm-dd-yyyy 00:00.00 AM/PM" in a text field. I have a workflow that updates a text field with text and time stamps it. I'm just trying to change the date format of NOW, I just don't know hwo to go about it outside of an Apex Class.
This is the current formula:
'Update text'+" "+ text(Now())
Any ideas?
So I'm trying to convert the NOW function into pst time zone with the date format of "mm-dd-yyyy 00:00.00 AM/PM" in a text field. I have a workflow that updates a text field with text and time stamps it. I'm just trying to change the date format of NOW, I just don't know hwo to go about it outside of an Apex Class.
This is the current formula:
'Update text'+" "+ text(Now())
Any ideas?
Salesforce gives the time in GMT format and by adding 5 hours you'll get PST time.
The below formula should work for your requirement with few tweaks.
IF(
OR(
VALUE( MID( TEXT( MYTIMEFIELD + (5/24)), 12, 2 ) ) = 0,
VALUE( MID( TEXT( MYTIMEFIELD + (5/24) ), 12, 2 ) ) = 12
),
"12",
TEXT( VALUE( MID( TEXT( MYTIMEFIELD + (5/24) ), 12, 2 ) )
-
IF(
VALUE( MID( TEXT( MYTIMEFIELD + (5/24)), 12, 2 ) ) < 12,
0,
12
)
)
)
& ":" &
MID( TEXT( MYTIMEFIELD + (5 /24)), 15, 2 )
& ":" &
MID( TEXT( MYTIMEFIELD + (5/24) ), 18, 2 )
& " " &
IF(
VALUE( MID( TEXT( MYTIMEFIELD + (5/24)), 12, 2 ) ) < 12,
"AM",
"PM"
)
Replace : MYTIMEFIELD with your Date & Time field.
If it answer your question, mark as solved.
Sathish P
All Answers
Refer this link
Salesforce gives the time in GMT format and by adding 5 hours you'll get PST time.
The below formula should work for your requirement with few tweaks.
IF(
OR(
VALUE( MID( TEXT( MYTIMEFIELD + (5/24)), 12, 2 ) ) = 0,
VALUE( MID( TEXT( MYTIMEFIELD + (5/24) ), 12, 2 ) ) = 12
),
"12",
TEXT( VALUE( MID( TEXT( MYTIMEFIELD + (5/24) ), 12, 2 ) )
-
IF(
VALUE( MID( TEXT( MYTIMEFIELD + (5/24)), 12, 2 ) ) < 12,
0,
12
)
)
)
& ":" &
MID( TEXT( MYTIMEFIELD + (5 /24)), 15, 2 )
& ":" &
MID( TEXT( MYTIMEFIELD + (5/24) ), 18, 2 )
& " " &
IF(
VALUE( MID( TEXT( MYTIMEFIELD + (5/24)), 12, 2 ) ) < 12,
"AM",
"PM"
)
Replace : MYTIMEFIELD with your Date & Time field.
If it answer your question, mark as solved.
Sathish P