CUC Forums

« Back to CUMI Questions

ArrivalTime format

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
I am trying to figure out how to translate the Message object's ArrivalTime tag (1352643695000) into an actual timestamp. That number should equate to approximately 11/11/2012 9:21 AM (EST) but for the life of me I can't figure out how! A message about one minute later had the number (1352643754000) for a difference of 59000, leading me to believe the last part is possibly milliseconds since midnight somewhere? But if the 13526 is days that means they started counting on Halloween in 1975! I'm sure I'm missing something here but please help if you can emoticon

it's milliseconds from Jan 1st 1970 - pretty standard fare for universal time formats - it's also stored in UTC of course so you need to convert to local time (usually) - in C# a little routine to convert from the ms into a local date time looks like this:



public static DateTime ConvertFromMillisecondsToTimeDate(long pMilliseconds)
        {
            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            origin = origin.AddMilliseconds(pMilliseconds);
            return origin.ToLocalTime();
        }
 

Thanks!  Do you happen to know if there is a way to query for only messages after a certain value of ArrivalTime?  Or do you have to grab all messages objects and cycle through.  I'm needing to grab only messages that are new to my application, so the read tag won't be of much help.

There's no filter for arrival time but you can of course sort by arrival time (default) and request X messages per page and keep working through the messages till you get to one that has the arrival time (or greater) you're looking for - with small enough page sizes (say 10 messages at a time) it'll be reasonably efficient - at worst getting 9 message records you didn't specifically need for your query.

And since my application server may not be in the same timezone as the voicemail system, is there a way in the API to determine the timezone of the user's mailbox and/or voicemail system so I can correctly convert the ArrivalTime?
 
Thanks again for all of the help!

Milliseconds or seconds?

http://en.wikipedia.org/wiki/Unix_time

milliseconds... some quick math on what you're getting back will verify...

I do AddSeconds to new DateTime(1970, 1, 1) and my dates match up too ☺
Did you check the Wikipedia link for Unix Time?

Oops I apologize. I use my email client for forum messages and didn’t pay attention that this was Unity forum but I was assuming AXL/Servicability. Yes it is milliseconds and not seconds.

Still probably wouldn't hurt to mention somewhere on cisco.com that the giant ArrivalTime tag value is milliseconds since 1970 for those of us who aren't used to dealing with timestamps like that emoticon  Thanks for the help!