Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2007, 10:16 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default Humanized dates

I wrote a function. Or rather, I rewrote some Javascript I found into C#.

It basically transforms a regular date into a date that's more readable for humans. So Oct 25th would return "Tomorrow", while October 24th would return "Today", etc.

I posted the function on my blog here: http://entropia-online.blogspot.com/...ates-in-c.html.

I tried putting in color to indicate the keywords etc, but blogspot is being a pain in the #ss.

I intend to sue this code (among other places) as a "wrapper" around dates indicating times posted in the forum, perhaps in the articles section, and definitely in the Private Messages section. I think it'd make a nice addition to the Globals class, actually.

Comments more than welcome :)

Cheers,

Peter


http://entropia-online.blogspot.com/
__________________
http://entropia-online.blogspot.com/
 
Old October 24th, 2007, 10:43 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

Peter,

Had a quick look and in essence, it looks fine. with my 'picky' hat on (and my mods suffer from this too), you appear to be missing any regionalisation in that code. now, i know this isn't a big issue if your audience will all be reading/writing in english, but it is something that we 'collectively' should consider. i know marco uses the resource tables for this purpose, i'm not 100% convinced that that is the most effective way and would prefer xml for this kind of thing (i.e. structured by country/keyword/translation).

anyway, that in itself is a whole other project, so i wont go there :) (YET!!)
other than that, i like your 'humanisation' of the dates and i for one would certainly use that kinda method.

jimi

http://www.originaltalent.com
 
Old October 24th, 2007, 07:17 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

nice!

Personally, I don't used future dates on my site yet...

The dates date I used was on the forum!

I made a asp.net forum to check the date and return:

Today, at 6.09
Yesterday at 6.09

Or the habitual date

But your funtion looks nice!
Now that I know where she is, maybe I could use it some day!

Peter, you passed from HateJavaScript to JSaholic lol

 
Old October 25th, 2007, 12:55 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 143
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hehe.

The only reason I did include future dates is because there might be in-game events hosted by users, or possibly we'd write an article about an upcoming event. I figured that if I'd translate the code, I might as well do it all the way, rather than having to rewrite the code again at a later day.

I'm now pondering also rewriting it to SQL. I've literally found squat while googling for something like this in C# or SQL. Only that bit of JS. And not to worry, I'm not a full blown fan yet, but I am starting to realize there's occassions where I just have to use JS.

Peter

http://entropia-online.blogspot.com/





Similar Threads
Thread Thread Starter Forum Replies Last Post
dates again dhoward VB.NET 2002/2003 Basics 12 August 22nd, 2007 09:48 AM
dates DARSIN General .NET 4 January 14th, 2005 09:09 AM
between dates capitala Access VBA 1 May 30th, 2004 05:20 PM
Dates treadmill SQL Language 3 July 3rd, 2003 02:32 PM
Dates oathamm Servlets 1 June 27th, 2003 05:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.