Friday, June 15, 2007

Siebel eScript Now() Function

There is no "Now()" function in Siebel eScript but you can write your own to return the current date/time off the server. Here's how it goes:

function Now(){
var dtNow = new Date();
var sNow = ( dtNow.getMonth()+1) + "/" + dtNow.getDate() + "/" + dtNow.getFullYear() + " "
+ dtNow.getHours() + ":" + dtNow.getMinutes() + ":" + dtNow.getSeconds();
return(sNow)
}


Note
  1. You should use SetFormattedFieldValue() if you are planning to use this on a business component field.
  2. This function returns server time. You may need to make adjustments based on local time for the user.