Skip to Content
0

How to get IST time

Feb 01, 2017 at 10:23 AM

137

avatar image

Dear All.

i'm using an expression ${date:now:yyyyMMdd 'at' hhmmss z} to get the date,time and the time zone.

the result i'm getting is 20170201 at 101744 GMT .

how can i get the IST time zone?

can you please suggest.

Regards

Ramesh

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Sriprasad Shivaram Bhat Feb 02, 2017 at 05:13 PM
1

Hello Ramesh,

Below will help you to convert the time to IST.

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.text.SimpleDateFormat;
import java.util.Date;

def Message processData(Message message) {

    def body = message.getBody();
    
    //Get current Date and Time.
    def currentUTCTime = new Date()
    
    //Declare a empty string to hold the Converted Time        
    def convertedISTTime='';
    
    //Convert and format it into required IST format
    convertedISTTime=currentUTCTime.format("yyyyMMdd ' at 'HH:mm:ss XXX", TimeZone.getTimeZone('IST'))
    
    //Set Property for your future use in integration process
    message.setProperty("P_CurrentISTTime", convertedISTTime );
    
    //Set the value to your Body if required.
    message.setBody(convertedISTTime);

return message;
}

Regards,

Sriprasad Shivaram Bhat

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Dear Sri.

Great Again.

first i would like to appreciate your contribution in SCN, thank you so much you contribution in in HCI space.

it's working fine.

Reagrds

Ramesh

1
Jansirani S Feb 02, 2017 at 04:53 AM
0

Ramesh,

Where do u use this expression?

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jasirrani.

i'm using this in my content container and the same content to be call to mail adapter's body by using ${body} expression.

Regards

Ramesh

0
Sriprasad Shivaram Bhat Feb 02, 2017 at 07:29 AM
0

Hello Ramesh,

I have tried the above case and seems its not possible to change it using expressions only.

You can use the script and get the time Converted to IST.

Regards,

Sriprasad Shivaram Bhat

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Sri.

Thanks for your time to check this option at your end.

Regards

Ramesh

0
K Ramesh Feb 02, 2017 at 08:40 AM
0

Can any one has the script for the same.

Share
10 |10000 characters needed characters left characters exceeded