web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Entityimage_timestamp field on contact entity

(0) ShareShare
ReportReport
Posted on by 30

Hi,

I need to import entityimage field from contact entity which is customer profile picture. 

Code written and pictures coming through. 

But, I need to when the customer uploads new file.

I can see a field in contact entity entityimages_timestamp field. It is int64

What is this field actually?

How can I convert to proper timestamp 

I have the same question (0)
  • Suggested answer
    Eiken Profile Picture
    on at

    Hi,

    I find the definition of "EntityImage_Timestamp" in a past document.

    Image Properties | Microsoft Learn

    pastedimage1678085551205v1.png

  • rajkm Profile Picture
    65 on at

    Hi Eiken

    Thanks for the reply.

    But it is a BIGINT, how do I know equivalent actual date and timestamp value. Either in C# code or sql end

  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    hi

    the entityimage field in the Contact entity stores the customer's profile picture. The entityimages_timestamp field is a system field that stores the timestamp of the last time the entityimage field was updated.

    The entityimages_timestamp field is stored as a 64-bit integer value that represents the number of 100-nanosecond intervals since January 1, 1601 (Coordinated Universal Time). To convert this value to a proper timestamp, you can use the following formula:

    Convert the entityimages_timestamp value to a DateTime object:

    long timestamp = (long)contact["entityimages_timestamp"];

    DateTime dateTime = new DateTime(1601, 1, 1, 0, 0, 0, DateTimeKind.Utc)

                       .AddTicks(timestamp);

    Convert the DateTime object to a string representation:

    string timestampString = dateTime.ToString("yyyy-MM-dd HH:mm:ss");

    This will give you a string representation of the timestamp in the format "yyyy-MM-dd HH:mm:ss". You can then use this string to display or compare the timestamp as needed.

    DAniele

  • Suggested answer
    Eiken Profile Picture
    on at

    Hi,

    You can convert the timestamp to date with the following function(from_unixtime) in MySql

    MySQL FROM_UNIXTIME() function - w3resource

  • rajkm Profile Picture
    65 on at

    Sorry, I am in Sql server end.

  • rajkm Profile Picture
    65 on at

    I have tried your suggestion. I got the data but the year shown as 3622 it is strange

       DateTime dt = new DateTime(1601, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddTicks(637874475651022629);

       MessageBox.Show(dt.ToString("yyyy-MM-dd HH:mm:ss"));

    entityimage_timestamp: 637874475651022629

    o/p: 3622-05-16 15:26:05

  • Suggested answer
    Eiken Profile Picture
    on at

    DATEADD(datepart,number,date) function is available in SQL Server.

    Please refer to the following link.

    How can I convert bigint (UNIX timestamp) to datetime in SQL Server? - Stack Overflow

     By the way, the data is obtained with hours, minutes and seconds, then you can use another CONVERT () function to remove the hours, minutes and seconds.

    Example:

    CONVERT(varchar(100),(SELECT DATEADD(s, dataeField / 1000, '1970-01-01 08:00:00')),23)

  • rajkm Profile Picture
    65 on at

    Do I need to deduct 1600(year) to get actual year?

    long timestamp = (long)contact["entityimages_timestamp"];

    DateTime dateTime = new DateTime(1601, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddTicks(timestamp);

    Convert the DateTime object to a string representation:

    string timestampString = dateTime.AddYears(-1600).ToString("yyyy-MM-dd HH:mm:ss");

  • Verified answer
    Eiken Profile Picture
    on at

    Hi,

    I think that this timestamp number is DateTime.Ticks.

    DateTime.Ticks Property (System) | Microsoft Learn

    Please try the following code.

    DateTime dt = DateTime.MinValue.AddTicks(634876488000000000);

    or
    DateTime dt = new DateTime(634876488000000000);
  • rajkm Profile Picture
    65 on at

    Thanks. It is working

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 46 Most Valuable Professional

#2
Pallavi Phade Profile Picture

Pallavi Phade 33

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 28 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans