Its simple... what is your time zone format? ours is +5:30 if we convert it to minutes its +330 in total day 24 hours if we convert it to minutes its 1440
so update your formula like this...
TIMEVALUE(NOW()+(330/1440))
in the place of 330 keep your timezone format converted into minutes.
You can use TIMENOW function .. Still do you want time from date.now()??
The TIMENOW() function returns a value in GMT representing the current time without the date. Use this function instead of the NOW() function if you want the current hour, minute, seconds, or milliseconds. This value is useful for tracking time like work shifts or elapsed time,
Its simple... what is your time zone format? ours is +5:30 if we convert it to minutes its +330 in total day 24 hours if we convert it to minutes its 1440
so update your formula like this...
TIMEVALUE(NOW()+(330/1440))
in the place of 330 keep your timezone format converted into minutes.
what is your time zone format?
ours is +5:30 if we convert it to minutes its +330
in total day 24 hours if we convert it to minutes its 1440
so update your formula like this...
TIMEVALUE(NOW()+(330/1440))
in the place of 330 keep your timezone format converted into minutes.
Let me know if it works.
All Answers
The TIMENOW() function returns a value in GMT representing the current time without the date. Use this function instead of the NOW() function if you want the current hour, minute, seconds, or milliseconds. This value is useful for tracking time like work shifts or elapsed time,
https://developer.salesforce.com/docs/atlas.en-us.usefulFormulaFields.meta/usefulFormulaFields/formula_examples_dates.htm
https://success.salesforce.com/answers?id=9063A000000iU8pQAE
Below code can fulfill your requirements, Hope this will work for you.
type 1 :
DateTime dt = DateTime.now();
string stringDate = dt.hour() + ':' + dt.minute() + ':' + dt.second();
System.debug(stringDate);
type 2 :
DateTime dt = DateTime.now();
System.debug(dt.time());
type 3:
Time as a string in “HH:MM:SS A/PM” format, use the following formula:
IF( OR( VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) = 0, VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) = 12 ), "12", TEXT( VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) - IF( VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) < 12, 0, 12 ) ) ) & ":" & MID( TEXT( date/time - TZoffset ), 15, 2 ) & ":" & MID( TEXT( date/time - TZoffset ), 18, 2 ) & " " & IF( VALUE( MID( TEXT( date/time - TZoffset ), 12, 2 ) ) < 12, "AM", "PM" )
Please mark this as best answer if this solves your problem.
Thank you,
Ajay Dubedi
You have to select Time data type in formula to create and use
TIMEVALUE(NOW())
I hope it will help you.
what is your time zone format?
ours is +5:30 if we convert it to minutes its +330
in total day 24 hours if we convert it to minutes its 1440
so update your formula like this...
TIMEVALUE(NOW()+(330/1440))
in the place of 330 keep your timezone format converted into minutes.
Let me know if it works.