cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1602
Views
0
Helpful
6
Replies

Time.valueOf(String) Convert String into Time

shongunisys
Level 1
Level 1

I am trying to use expression editor to change string in time format(10:10:00) to the actual time format (T[10:10:00]). The syntax is Time.valueOf(string)but I keep getting errors.

Thanks,

1 Accepted Solution

Accepted Solutions

Dennis Fogler
Cisco Employee
Cisco Employee

I was able to get this to work in the script editor as follows:

Create one String Variable called StringTime & make the default value "10:10:00 AM". Next

create one Time Variable called RealTime

Using the "Set" Step click on "properties". In the first drop down box select the variable RealTime. In the second drop down box click on ... to launch the Expressions Editor.

When the Expressions Editor launches, type the following:

RealTime.valueOf(StringTime)

Click OK. Then OK again.

The Set step should look like:

RealTime = RealTime.valueOf(StringTime)

Also make sure your string value designates either AM or PM such as "10:10:00 AM"

Hope this helps. Please rate all posts!!

View solution in original post

6 Replies 6

Dennis Fogler
Cisco Employee
Cisco Employee

I was able to get this to work in the script editor as follows:

Create one String Variable called StringTime & make the default value "10:10:00 AM". Next

create one Time Variable called RealTime

Using the "Set" Step click on "properties". In the first drop down box select the variable RealTime. In the second drop down box click on ... to launch the Expressions Editor.

When the Expressions Editor launches, type the following:

RealTime.valueOf(StringTime)

Click OK. Then OK again.

The Set step should look like:

RealTime = RealTime.valueOf(StringTime)

Also make sure your string value designates either AM or PM such as "10:10:00 AM"

Hope this helps. Please rate all posts!!

hi

When I try this I get the following error

"For input String ; 0 AM nested exception is

Java.langNumber Format exception

My String value is 14:00:15 AM

Wow, this thread is 3 years old....nice find.

Were you not satisfied with the people helping you in your original thread?

https://supportforums.cisco.com/message/3030538

I feel like I'm missing something... What should the value of "RealTime" be?

I've configured it per your post but am also getting an error.StringToTime1.PNGStringToTime2.PNG

hi,  

You have received some additional response, resolved that error message, the same thing happens to me as to you, but in my case I am not directly using the mentioned expression, since I do not see it available in the uccx 12.5.1 editor

RealTime.valueOf(StringTime)

The one I am using is the following:

Time.valueOf(StringTime)

but i get the same error as you mention.

yiosepvaldes
Level 1
Level 1

@Dennis Fogler @Uriah Erter @Anthony Holloway @shongunisys 

hi,

I am having the same problem described in this conversation, but I am in a cuccx 12.5.1 su1 editor, and the step or syntax that I am trying to use to convert the data or variable content is the following:

RealTime.valueOf(StringTime) *** It does not appear available in the construction or edition of variables

The one I am using is the following:

Time.valueOf(StringTime)

but I get the following error just like someone else here

yiosepvaldes_0-1680531965693.png

 

help!! support to solve and understand this inconvenience. !!!

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: