Skip to Content

How to get IST time

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Feb 02, 2017 at 05:13 PM

    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

    Add comment
    10|10000 characters needed 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

  • avatar image
    Former Member
    Feb 02, 2017 at 04:53 AM

    Ramesh,

    Where do u use this expression?

    Add comment
    10|10000 characters needed 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

  • Feb 02, 2017 at 07:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2017 at 08:40 AM

    Can any one has the script for the same.

    Add comment
    10|10000 characters needed characters exceeded