on 02-01-2017 10:23 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi Sri,
How can we convert time from IST to UTC timezone? In fact, for all the conversions, what time zone does the system considers as a source timezone.
In the above example, def currentUTCTime = new Date() , this line gives time in UTC time zone.
But , if my source time is in different time zone(Other than UTC) then, how can I convert this to UTC timezone.
Regards,
Santosh Pathuri
Can any one has the script for the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ramesh,
Where do u use this expression?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.