Author |
Message
|
Capcop |
Posted: Wed Aug 31, 2005 11:45 am Post subject: Function System.currentTimeMillis() |
|
|
Novice
Joined: 27 Jul 2004 Posts: 17
|
hi
what's the function equal in ESQL?
java= System.currentTimeMillis()
ESQL= ?
please..
thanks _________________ ---------------
Capcop IEE |
|
Back to top |
|
 |
JT |
Posted: Wed Aug 31, 2005 11:52 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
The CURRENT_TIME function provides hh:mm:ss.000000 |
|
Back to top |
|
 |
Capcop |
Posted: Wed Aug 31, 2005 11:56 am Post subject: |
|
|
Novice
Joined: 27 Jul 2004 Posts: 17
|
yes,
but i need only millisecond, as such System.currentTimeMillis()
i need return long.
help me please  _________________ ---------------
Capcop IEE |
|
Back to top |
|
 |
JT |
Posted: Wed Aug 31, 2005 12:00 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
......so, then you extract the value from the timestamp using the SUBSTRING function. |
|
Back to top |
|
 |
Capcop |
Posted: Wed Aug 31, 2005 12:34 pm Post subject: |
|
|
Novice
Joined: 27 Jul 2004 Posts: 17
|
but i need compute the date in millisecond, namely, the subtraction between 01/01/1970 and today
Java:
System.currentTimeMillis()
return
1120000031239
that same i need, but in ESQL
the function ESQL
Set ls_gmttime = CAST(CURRENT_GMTTIMESTAMP AS CHAR CCSID OutputRoot.MQMD.CodedCharSetId
ENCODING OutputRoot.MQMD.Encoding);
return
GMTTIMESTAMP '2005-08-31 20:20:20.678407'
i don't make  _________________ ---------------
Capcop IEE |
|
Back to top |
|
 |
bbakerman |
Posted: Wed Aug 31, 2005 5:53 pm Post subject: |
|
|
Apprentice
Joined: 17 Dec 2003 Posts: 41
|
If you are on a later enough version of broker (WBI 5 CSD 5 I think) you could simply wrap the Java call. I created a timestamp object below but you could easily call the System
CREATE PROCEDURE System_currentTimeMillis() RETURNS INTEGER
LANGUAGE JAVA EXTERNAL NAME "java.lang.System.currentTimeMillis";
(Java Long map to ESQL Integer)
I used this
CREATE PROCEDURE ACTUAL_TIMESTAMP() RETURNS TIMESTAMP
LANGUAGE JAVA EXTERNAL NAME "com.ibm.wbihmb.fld.DateTimeKit.currentTimestamp";
/**
* The WBI Brokers version of CURRENT_TIMESTAMP are brain dead in that they
* return the same value for a given processing node. For example you cant
* do this
*
* declare then timestamp current_timestamp;
* ...
* ...
* declare now timestamp current_timestamp;
*
* because the values are the same! As the doco says :
*
* CURRENT_TIMESTAMP returns a TIMESTAMP value representing the current date and local time.
* As with all SQL functions that take no parameters, no parentheses are required or accepted.
* All calls to CURRENT_TIMESTAMP within the processing of one node are
* guaranteed to return the same value.
*
* This actually works as expected.
*/
public static MbTimestamp currentTimestamp() {
Calendar cal = Calendar.getInstance();
MbTimestamp now =
new MbTimestamp(
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH),
cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE),
cal.get(Calendar.SECOND),
cal.get(Calendar.MILLISECOND));
return now;
} |
|
Back to top |
|
 |
EddieA |
Posted: Wed Aug 31, 2005 7:27 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
the subtraction between 01/01/1970 and today |
So, look up INTERVAL in the manual.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
javaforvivek |
Posted: Thu Sep 01, 2005 1:45 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
bbakerman wrote:
Quote: |
If you are on a later enough version of broker (WBI 5 CSD 5 I think) you could simply wrap the Java call |
Its CSD4 onwards. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
|