Alternate to TimeSpan

I have a date coming from database that I need to display to difference between now and that date. I know that is done with TimeSpan, but is that only way to use TimeSpan or any other way we can use..
lets say date is 5/30/2009 12:00:00 AM comes back from database and I want to see how many days left for my renewing my subscription.
how can I do that without TimeSpan if I can?
1jawsAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
käµfm³d 👽Connect With a Mentor Commented:
This still uses TimeSpan, but it gives you the number of days (would this be sufficient?):
DateTime d1 = "12/01/2009";  //Date from database
 
int days = d1.Subtract(DateTime.Now).Days;

Open in new window

0
 
philipjonathanCommented:
You can get the number of days from the TimeSpan's Days property ...
0
 
1jawsAuthor Commented:
I have already done that I wonder any other way can be done or do I have to use TimeSpan for sure..
0
 
tetorvikConnect With a Mentor Commented:
Not saying this is advisable, but you can surely do this without TimeSpan.
            DateTime renewalDate = new DateTime(2010, 1, 1);
            int days = Convert.ToInt32((renewalDate.Ticks - DateTime.Now.Ticks) * 1.1574074074074074E-12);

Open in new window

0
 
1jawsAuthor Commented:
ok thanks for the advice, I think I will stick with TimeSpan :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.