cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1424
Views
0
Helpful
3
Replies

UCCX today .getDate shows epoch time

amora1977
Beginner
Beginner

Hello Folks , I'm triyin to construct a new date to use it later for an if, the set today = new Date or set today = D[now] works fine,but the set new date ( today .getDate () + ( mills_in_a_day ) shows the epoch time january 1 1970. Is there sometinh missing?

UCCX Version 10.5 Premium

 

Thanks a lot

1 Accepted Solution

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

getDate() returns the day of the month.  E.g., today would be 17

 

new Date(long) instantiates a new Date object using long's value as the number of millis since 1/1/1970 00:00:00.000.

 

E.g.,

 

new Date(17) = 1/1/1970 00:00:00.017

 

I think you want getTime(), which returns the number of millis since epoch for the current datetime.

View solution in original post

3 Replies 3

Anthony Holloway
Cisco Employee
Cisco Employee

getDate() returns the day of the month.  E.g., today would be 17

 

new Date(long) instantiates a new Date object using long's value as the number of millis since 1/1/1970 00:00:00.000.

 

E.g.,

 

new Date(17) = 1/1/1970 00:00:00.017

 

I think you want getTime(), which returns the number of millis since epoch for the current datetime.

Hello Anthony , thanks for your response, you are the man!.

I change the set as you posted and works perfect, by the way, why the getTime resolve the date? I'm a little confused, I used the solution on a previous post that use detonate:

 

https://community.cisco.com/t5/contact-center/how-to-get-tomorrows-date-in-uccx-script/td-p/1752963

 

Thanks for your help

If your question is why getTime() returns a value pertaining to the date, then it's because there is no spoon. No, but seriously, there is no Date and Time, only milliseconds since epoch. We just read the amount of millis as a date and time, which each are further broken down into year, month, day and hours, minutes, seconds, respectively.

Also, it looks like I had a typo in that old example, and I'll go fix it now, to be getTime().
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: