List Info

Thread: C-Sharp (C#) Group: time ago display




C-Sharp (C#) Group: time ago display
user name
2006-08-10 00:34:12
Hello,
I would like to do some C# in SQL 2005 That will convert a
date/time to
show
"sec, mins, hours, days, weeks, months, years
ago"  like 3 mins ago or
12 hrs ago.
I have seen this in numerous places but when I try to search
on the
best way to do it I get nothing.  I have to take into
account months
with 31 days, Feb, leap years.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: time ago display
user name
2006-08-10 07:20:17
System.TimeSpan TS = new System.TimeSpan(endDate.Ticks-startDate.Ticks);

There are a bunch of properties for getting the units of time out.

Liam

On 8/10/06, ShadowFlame <gmail.com">dsmsearsgmail.com> wrote:

Hello,
I would like to do some C# in SQL 2005 That will convert a date/time to
show
&quot;sec, mins, hours, days, weeks, months, years ago"&nbsp; like 3 mins ago or
12 hrs ago.
I have seen this in numerous places but when I try to search on the
best way to do it I get nothing.&nbsp; I have to take into account months
with 31 days, Feb, leap years.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: time ago display
user name
2006-08-11 00:13:19
Are you doing this in C# or SQL?
If C#, look at what Liam wrote

If SQL, use the DateDiff(datepart, startdate, enddate) where
datepart
are your standard date parameters (year, quarter, month,
dayofyear,
day, week, hour, minute, second and millisecond).  It will
return an
integer with the difference.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )