datetime - How do I nicely display relative time using VB.NET? -


I want to display a "Date / Time Submit" value as stack overflows

E.g. * 2 hours ago * 3 days ago * a month ago

I get a broad answer on how to do this on PHP, but can someone help me in the VB version?

Calculate the exact time since the first submission:

  Dim t as timspin = datetime.Now - the submitted time  

Then you decide what interval you want to use to display the results. For example:

  If T shortscands & lt; 60 Then display = "less than a minute ago" LSF minority & lt; 60 then display = t. Minute. Toastring () + "minutes ago" otherwise ... ... and at the end if  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -