ArrivalTime format

Version 1
    This document was generated from CDN thread

    Created by: Roger Northrop on 11-11-2012 08:56:36 AM
    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

    Subject: RE: ArrivalTime format
    Replied by: Jeff Lindborg on 11-11-2012 09:12:41 AM
    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();
            }
     

    Subject: RE: ArrivalTime format
    Replied by: Roger Northrop on 11-11-2012 09:18:27 AM
    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.

    Subject: RE: ArrivalTime format
    Replied by: Jeff Lindborg on 11-11-2012 09:23:53 AM
    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.

    Subject: RE: ArrivalTime format
    Replied by: Roger Northrop on 11-11-2012 09:41:15 AM
    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!

    Subject: RE: New Message from Jeff Lindborg in Cisco Unity Connection(CUC) - CUMI Qu
    Replied by: Shivinder Singh on 14-11-2012 09:18:48 AM
    Milliseconds or seconds?

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

    Subject: RE: New Message from Jeff Lindborg in Cisco Unity Connection(CUC) - CUMI Qu
    Replied by: Jeff Lindborg on 14-11-2012 09:30:16 AM
    milliseconds... some quick math on what you're getting back will verify...

    Subject: RE: New Message from Jeff Lindborg in Cisco Unity Connection(CUC) - CUMI Qu
    Replied by: Shivinder Singh on 14-11-2012 09:42:48 AM
    I do AddSeconds to new DateTime(1970, 1, 1) and my dates match up too ☺
    Did you check the Wikipedia link for Unix Time?

    Subject: RE: New Message from Jeff Lindborg in Cisco Unity Connection(CUC) - CUMI Qu
    Replied by: Shivinder Singh on 14-11-2012 09:44:48 AM
    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.

    Subject: RE: New Message from Jeff Lindborg in Cisco Unity Connection(CUC) - CUMI Qu
    Replied by: Roger Northrop on 14-11-2012 09:57:28 AM
    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  Thanks for the help!