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
seshasesha 

From GMT TO IST (Indian Standard Time)

Hi 

have used the Below code to get the conversion from GMT TO AEST( Australian Eastern Standard Time),any ideas on using the below code for conversion from GMT TO IST/any alternatives?

We know that IST is + 5 and 1/2 Hours before GMT,Whearas AEST is + 10 hours, so the 1/2 hour is the problem.

Code for conversion of GMT to AEST(Courtesy Steve Lamb),Field Type: Formula,Return Type : Text

if(ISNULL(CreatedDate ), "", Text(CASE(VALUE(MID(TEXT(  CreatedDate ) , 12, 2)) , 0, 10, 1, 11, 2, 12,3, 1,4, 2,5, 3,6, 4,7, 5,8, 6,9, 7,10, 8,11, 9,12,10,13,11,14,12,15, 1,16, 2,17, 3,18,4,19,5,20,6,21, 7,22,8,23,9,24)) & ":" & MID(TEXT( CreatedDate ) , 15, 2) & IF(AND(VALUE(MID(TEXT( CreatedDate ) , 12, 2)) >= 14, VALUE(MID(TEXT( CreatedDate  ) , 12, 2)) <= 1), " AM", " PM"))


regards
Seshagiri Rao

 

Shivanath DevnarayananShivanath Devnarayanan

Hello,

 

I am not sure why you are using this logic if you just plan to convert one time in a Time zone to a different time zone,

 

you could probably use Datetime.format


Returns a Datetime as a string using the supplied Java simple date format and time zone. If the supplied time zone is not in the correct format, GMT is used.

This example uses format to convert the date and time to the PST time zone and to format it using the specified format string.
Datetime GMTDate = Datetime.newInstanceGmt(2011,6,1,12,1,5);
String strConvertedDate = GMTDate.format('dd/MM/yyyy hh:mm:ss a', 'PST');

For more information on the Java simple date format, see Java SimpleDateFormat.

 

Link : http://bit.ly/HxpRG1 

 

Maybe I'm missing something, if this doesnt solve your problem could you please give more details ?

 

thank you 

 


seshasesha

Hi Shivnath

 

thanks for your reply.

 

problem is i do not know java?done using the standard Functions on the Platform.

 

can u help me with any code for this time conversion.

 

 

regards

seshagiri

Shivanath DevnarayananShivanath Devnarayanan

Seshu,

 

I'm not sure how to convert GMT to IST using the Above formula on top of my head, I will try it out and post back if i come up to a solution.

 

But meanwhile if it is helpful, i could tell you how to do it via Apex,

and may be we could comeup with a solution to your problem. Can you give more insight on what you're trying to achieve