ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Function System.currentTimeMillis()

Post new topic  Reply to topic
 Function System.currentTimeMillis() « View previous topic :: View next topic » 
Author Message
Capcop
PostPosted: Wed Aug 31, 2005 11:45 am    Post subject: Function System.currentTimeMillis() Reply with quote

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
View user's profile Send private message MSN Messenger
JT
PostPosted: Wed Aug 31, 2005 11:52 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

The CURRENT_TIME function provides hh:mm:ss.000000
Back to top
View user's profile Send private message
Capcop
PostPosted: Wed Aug 31, 2005 11:56 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
JT
PostPosted: Wed Aug 31, 2005 12:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Capcop
PostPosted: Wed Aug 31, 2005 12:34 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
bbakerman
PostPosted: Wed Aug 31, 2005 5:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
EddieA
PostPosted: Wed Aug 31, 2005 7:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
javaforvivek
PostPosted: Thu Sep 01, 2005 1:45 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Function System.currentTimeMillis()
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.