none
How to retrive a date time value from TimeStamp column using Linq RRS feed

  • Question

  • I have a Timestamp column in my Table. I want to read the date time value and display in UI.

    In Linq the Timestamp column is represented as System.Data.Linq.Binary.

    I dont know how to retirve date time value in "MM-dd-YYYY" format from this Linq.Binary

    plz help me out.

     

    - Why I am using Timestamp.

    I want to perform some operations based on the last modified date time of the particular row. Since I am using TimeStamp column in my Table as version column, It will contain the last modified date details, So i want to read the date time value from this time stamp column to do some other operations.


    - Mohamed Yasar M

     

    Thursday, October 21, 2010 10:18 AM

Answers

  • TimeStamp does not have anything to do with an actually Time.  From my knowledge it is a sequential binary iteration.  The database automatically manages TimeStamps. 

    The TimeStamp is used with Optimistic Concurrency.  So:

    1.     If User1 and User2 have Row1.

    2.     User1 updates Row1.

    3.     User2 tries to update Row1 and Error occurs since Row1 is in a different state that the original received state.

    Like JA stated, use DateTime.

    • Marked as answer by Yasar M Thursday, October 21, 2010 2:25 PM
    Thursday, October 21, 2010 2:03 PM

All replies

  • Hi,

    Why don't you add a DateTime field to your database with default value equals to DateTime.Now when a row is modified?

    Timespan is really different than DateTime.

    Best regards,

    JAReyes,


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solucion de esta pregunta te ha sido útil.
    • Proposed as answer by LitEnders Thursday, October 21, 2010 2:32 PM
    Thursday, October 21, 2010 1:13 PM
  • TimeStamp does not have anything to do with an actually Time.  From my knowledge it is a sequential binary iteration.  The database automatically manages TimeStamps. 

    The TimeStamp is used with Optimistic Concurrency.  So:

    1.     If User1 and User2 have Row1.

    2.     User1 updates Row1.

    3.     User2 tries to update Row1 and Error occurs since Row1 is in a different state that the original received state.

    Like JA stated, use DateTime.

    • Marked as answer by Yasar M Thursday, October 21, 2010 2:25 PM
    Thursday, October 21, 2010 2:03 PM
  • thanks

    I misunderstood like timestamp contains date time values.

    Now i added one more DateTime column to store the modifed date time. and using this timestamp  as a version column.

     

    -Mohamed Yasar M


    - Mohamed Yasar M
    Thursday, October 21, 2010 2:26 PM
  • Hi Mohamed,

    What's wrong with my answer?

    Best regards,

    JAReyes.


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solucion de esta pregunta te ha sido útil.
    Friday, October 22, 2010 7:26 AM
  • hi JaReyes,

    thanks for ur reply

    U r right, but as i mentioned already i have a versioning column as a timestamp for linq. so i want to use the same instead of adding one more column. also i solved the issue by some design changes, instead of changing the timestamp to datetime column.

     


    - Mohamed Yasar M
    Monday, October 25, 2010 12:06 PM