# I have to set text the Current date in an application. So I have Created a Keyword as follows

**URL:** <https://forum.katalon.com/t/i-have-to-set-text-the-current-date-in-an-application-so-i-have-created-a-keyword-as-follows/42179>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [April 11, 2020, 1:51pm UTC](https://forum.katalon.com/t/i-have-to-set-text-the-current-date-in-an-application-so-i-have-created-a-keyword-as-follows/42179 "2020-04-11T13:51:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepa.saravanan](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@deepa.saravanan](https://forum.katalon.com/u/deepa.saravanan)\
**Post date:** [April 11, 2020, 1:51pm UTC](https://forum.katalon.com/t/i-have-to-set-text-the-current-date-in-an-application-so-i-have-created-a-keyword-as-follows/42179/1 "2020-04-11T13:51:16Z")

</div>

package date\_Picker\_Functions

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject  
import static java.util.Calendar.\*

import java.text.SimpleDateFormat as SimpleDateFormat

import com.kms.katalon.core.annotation.Keyword as Keyword  
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

public class Current\_Date {

```
@Keyword

def call(){
	def date = new Date()
	
	def sdf = new SimpleDateFormat("dd/MM/yyyy")
	
	println sdf.format(date)
			
	return sdf.format(date)
	
}

```

}

Now I have to set text the variable date in the Application. How Can I do this? Can Anyone Please help me to sort it out?

I am getting the Error as,

No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.setText() is applicable for argument types: (com.kms.katalon.core.testobject.TestObject, com.kms.katalon.core.testobject.TestObject) values: [TestObject - ‘Object Repository/03. Account Payable (AP)/Page\_AP Invoice - UPM IBU PEJABAT/Post Date’, …] Possible solutions: setText(com.kms.katalon.core.testobject.TestObject, java.lang.String), getText(com.kms.katalon.core.testobject.TestObject), getText(com.kms.katalon.core.testobject.TestObject, com.kms.katalon.core.model.FailureHandling), setText(com.kms.katalon.core.testobject.TestObject, java.lang.String, com.kms.katalon.core.model.FailureHandling), clearText(com.kms.katalon.core.testobject.TestObject), clearText(com.kms.katalon.core.testobject.TestObject, com.kms.katalon.core.model.FailureHandling)

---

<div class="post-metadata">

**Author:** ![francorebu](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/francorebu/32/16103_2.png) [@francorebu](https://forum.katalon.com/u/francorebu)\
**Post date:** [April 11, 2020, 4:39pm UTC](https://forum.katalon.com/t/i-have-to-set-text-the-current-date-in-an-application-so-i-have-created-a-keyword-as-follows/42179/2 "2020-04-11T16:39:35Z")

</div>

Hi , I think the error is cause you are trying to set a ‘date’ with the settext method. but settext method im not sure if allows that. I know it allows string format.

Try this:

@Keyword  
def getCurrentDate(){  
Date date = new Date()  
String datePart = date.format(“dd/MM/yyyy”)  
return datePart  
}
