How to split time from date?
Content
Hi Team,
I want to fetch the time from creationdate of SR. Creationdate is a datetime type. Below is the example
Creationdate : 2020-12-21 10:04:28.0
I want 10:04 from the date. I have tried using substring function but it is not working.Also tried the below script from the groovy script document but it is not accessible from script and throwing error
//To format a datetime value datetimeVal to display only the hours and minutes in 24-hour format, you can do:
Date dv = datetimeVal as Date
def fmt = new Formatter(adf.context.locale)
def ret = (dv != null) ? fmt.format('%tH:%tM', dv, dv) : null
Tagged:
1