on 01-25-2013 8:15 AM
Hi All,
I have a requirement where i have to display server time in webdynpro java can anyone tell me how to do that.
Thanks,
Rahul.
Hi Rahul,
Please use this
Date date = new Date(System.currentTimeMillis()); | |
Format format = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); | |
wdComponentAPI.getMessageManager().reportSuccess("Time ::"+ format.format(date).toString()); |
I think this might solve your query.
Rgds,
Pankaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
For that you need to write javascript. But WD doesnt support javascript, so you have to create a BSP application and write the Java script in the BSP page.
In WD add UI element iFrame and give the url of your BSP app as the "source" property of iFrame.
Javascript code for clock :
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function MakeArrayday(size) {
this.length = size;
for(var i = 1; i <= size; i++) {
this[i] = "";
}
return this;
}
function MakeArraymonth(size) {
this.length = size;
for(var i = 1; i <= size; i++) {
this[i] = "";
}
return this;
}
function funClock() {
if (!document.layers && !document.all)
return;
var runTime = new Date();
var hours = runTime.getHours();
var minutes = runTime.getMinutes();
var seconds = runTime.getSeconds();
var dn = "AM";
if (hours >= 12) {
dn = "PM";
hours = hours - 12;
}
if (hours == 0) {
hours = 12;
}
if (minutes <= 9) {
minutes = "0" + minutes;
}
if (seconds <= 9) {
seconds = "0" + seconds;
}
movingtime = "<b>"+ hours + ":" + minutes + ":" + seconds + " " + dn + "</b>";
if (document.layers) {
document.layers.clock.document.write(movingtime);
document.layers.clock.document.close();
}
else if (document.all) {
clock.innerHTML = movingtime;
}
setTimeout("funClock()", 10)
}
window.onload = funClock;
</script>
</head>
<body>
<center> Currently, it's <span id=clock></span> </center>
<form action="Clock.html" method="get">
</form>
</body>
</html>
Let me know if this works for you.
Rgds,
Pankaj
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.