I am trying to include alarm date creation time in my email alert and using the following to get the same:
It is generating time in "YYYY-MM-DD HH24:MI:SS.MS" format.
I need it in "MM/DD/YYYY HH24:MI:SS"
Can someone help with this?
The timestamp you’re getting back from the query/line is a TimeStamp object, so you can format it.
Here is some example code for controlling the format:
SimpleDateFormat dateFormat = new SimpleDateFormat("M/dd/yyyy HH:mm:ss");
tstamp = scope.get("alarms").createdTime;
return dateFormat.format( tstamp );
You can change the format by changing the string you give SimpleDateFormat. I would suggest you google “Java SimpleDateFormat” (without the quotes) to get more information on the available values for the format string.
David Judge (Disclosure: I work for D Software the local office partner for Dell Software in EMEA's emerging markets)
Thank you so much. It worked.