473,503 Members | 1,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date Relative String

Hi all,

I am after a way of returning a string to indicate date/time span.

For example,
If I was to pass a date 10 days from now it might return "next week",
If I was to pass a date 7 days ago it might return "last week",
If I was to pass a date 30 days from now it might return "next month"
If I was to pass a date of now+1 it would return "tomorrow"
If I was to pass a time of two hours from now it would return "2
hours from now"

Hope you get the idea. The same sort of thing happens in Outlook if
you group by date.

Just wondering if anyone knows an easy way of doing this. I could code
this up myself but lots of applications provide this facility so I
figure it must be out there somewhere. Does anyone know how to do
this?

Cheers,
Kym

Apr 24 '06 #1
3 1146
The .net framework doesn't provide something like that (maybe you can find
free code in the internet).
But it shouldn't be so complicated.

"kymbo" <kp*********@gmail.com> schrieb im Newsbeitrag
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi all,

I am after a way of returning a string to indicate date/time span.

For example,
If I was to pass a date 10 days from now it might return "next week",
If I was to pass a date 7 days ago it might return "last week",
If I was to pass a date 30 days from now it might return "next month"
If I was to pass a date of now+1 it would return "tomorrow"
If I was to pass a time of two hours from now it would return "2
hours from now"

Hope you get the idea. The same sort of thing happens in Outlook if
you group by date.

Just wondering if anyone knows an easy way of doing this. I could code
this up myself but lots of applications provide this facility so I
figure it must be out there somewhere. Does anyone know how to do
this?

Cheers,
Kym

Apr 24 '06 #2
I agree it shouldn't be too hard to put something like this together --
I just thought it might exist somewhere already...

Oh well, at least I can get my hands dirty with a bit of code :)

*tap* *tap* *tap*

Apr 25 '06 #3
The problem is that every application has its own needs. if we have date
31-12 and you want to get the string of next day. this is next month, next
week, next year or tomorrow? is 23:00 o'clock +1 hour "in one hour" or
tomorrow?

"kymbo" <kp*********@gmail.com> schrieb im Newsbeitrag
news:11*********************@y43g2000cwc.googlegro ups.com...
I agree it shouldn't be too hard to put something like this together --
I just thought it might exist somewhere already...

Oh well, at least I can get my hands dirty with a bit of code :)

*tap* *tap* *tap*

Apr 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
9267
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
8
9425
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
5199
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
3
1293
by: Bob Stearns | last post by:
I have a column which is the relative day number to give a treatment on. For a particular patient, where I know the starting date, how do I show the actual date for each relative day? the best I...
6
11738
by: openleren | last post by:
Hi all, how can I use a relative path in my web.config file for an Access db?: Instead of using <configuration> <appSettings> <add key="conAccess" value="microsoft.jet.oledb.4.0;data...
4
4133
by: Christie | last post by:
My app creates a rigistry entry of the date when it is installed, which is then used to determine when the demo expires...It is working fine but I would like to encrypt the date somehow...is there...
44
10127
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
15
4328
by: Steve | last post by:
Hi All, I have a registration code that currently has 4 bytes that are unused. I'd like to store a future date in those 4 bytes. Is there a way to convert a date to a 4 byte string? When I...
1
3159
by: vp.softverm | last post by:
hi all . Am facing problem with the date picker. when i click on date picker in a popup window. the date table is opened in the middle of the pop up window. and it is unable to scroll with...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.