Answered by:
DateTime.Now.Ticks verse DateTime in web forms app

Question
-
User-1188570427 posted
I am sending emails based on a certain DateTime.
I need to save that DateTime in my database in a notification table in some form.
The email might not go out exactly at that DateTime specified, but is it better to save the actual DateTime value in the database or can I save the .Tick value as a string in the database and query off of that?
Thanks.
Tuesday, December 11, 2018 5:08 AM
Answers
-
User753101303 posted
Hi,
Not sure to see which benefit you see in using Ticks. It seems enough and easier to just use DateTime.Now or UtcNow and store them as datetimes ? Or you try to use this as a kind of "identifier" ? You have a Message-ID header but I never tried to see if it could be provided from the SMTP client side rather than being assigned by the mail server.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, December 11, 2018 9:56 AM -
User-1716253493 posted
Save the data as datetime value, if you need tick value see below
http://michaeljswart.com/2017/07/converting-from-datetime-to-ticks-using-sql-server/
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, December 11, 2018 1:03 PM
All replies
-
User753101303 posted
Hi,
Not sure to see which benefit you see in using Ticks. It seems enough and easier to just use DateTime.Now or UtcNow and store them as datetimes ? Or you try to use this as a kind of "identifier" ? You have a Message-ID header but I never tried to see if it could be provided from the SMTP client side rather than being assigned by the mail server.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, December 11, 2018 9:56 AM -
User-1716253493 posted
Save the data as datetime value, if you need tick value see below
http://michaeljswart.com/2017/07/converting-from-datetime-to-ticks-using-sql-server/
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, December 11, 2018 1:03 PM -
User-1188570427 posted
Hi,
Not sure to see which benefit you see in using Ticks. It seems enough and easier to just use DateTime.Now or UtcNow and store them as datetimes ? Or you try to use this as a kind of "identifier" ? You have a Message-ID header but I never tried to see if it could be provided from the SMTP client side rather than being assigned by the mail server.
Thank you for your opinion!
Tuesday, December 11, 2018 1:34 PM -
User-1188570427 posted
Save the data as datetime value, if you need tick value see below
http://michaeljswart.com/2017/07/converting-from-datetime-to-ticks-using-sql-server/
Thank you for your opinion!
Tuesday, December 11, 2018 1:34 PM