DateTime Range. Without year ...

This is a discussion on DateTime Range. Without year ... within the DOTNET forums in Framework and Interface Programming category; Hello, I am checking a DateTime variable to check if in range: low < MyDateTime < high. However, I know need do the same but not care about the year. Can I do this? Thanks, Miguel...

Go Back   Application Development Forum > Framework and Interface Programming > DOTNET

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-08-2008, 02:27 AM
shapper
Guest
 
Default DateTime Range. Without year ...

Hello,

I am checking a DateTime variable to check if in range: low <
MyDateTime < high.

However, I know need do the same but not care about the year. Can I do
this?

Thanks,
Miguel
Reply With Quote
  #2  
Old 09-08-2008, 04:36 AM
Eliyahu Goldin
Guest
 
Default Re: DateTime Range. Without year ...

Bring an example what you mean.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"shapper" <mdmoura@gmail.com> wrote in message
news:2d5e3845-3861-49ec-8ed3-c525d18d8ce9@b1g2000hsg.googlegroups.com...
> Hello,
>
> I am checking a DateTime variable to check if in range: low <
> MyDateTime < high.
>
> However, I know need do the same but not care about the year. Can I do
> this?
>
> Thanks,
> Miguel



Reply With Quote
  #3  
Old 09-08-2008, 07:31 AM
shapper
Guest
 
Default Re: DateTime Range. Without year ...

On Sep 8, 9:36*am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.org> wrote:
> Bring an example what you mean.
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
>
> "shapper" <mdmo...@gmail.com> wrote in message
>
> news:2d5e3845-3861-49ec-8ed3-c525d18d8ce9@b1g2000hsg.googlegroups.com...
>
> > Hello,

>
> > I am checking a DateTime variable to check if in range: low <
> > MyDateTime < high.

>
> > However, I know need do the same but not care about the year. Can I do
> > this?

>
> > Thanks,
> > Miguel


Well, consider the following two dates:

Start:
2007-09-08 11:29:50

Finish:
2007-10-12 12:30:20

Then the test date:
2008-09-22 08:29:50

The test date is between the other two dates if you don't consider the
year. That is what I need to test.

Thanks,
Miguel

Reply With Quote
  #4  
Old 09-08-2008, 09:37 AM
Eliyahu Goldin
Guest
 
Default Re: DateTime Range. Without year ...

Then you simply need to bring all dates to the same year:

DateTime startToTest = new DateTime(test.Year, start.Month, start.Day);
DateTime finishToTest = new DateTime(test.Year, finish.Month, finish.Day);

and check if startToTest < test < finishToTest.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"shapper" <mdmoura@gmail.com> wrote in message
news:6db6e735-0384-42b1-be86-d04e9d3db191@f36g2000hsa.googlegroups.com...
On Sep 8, 9:36 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.org> wrote:
> Bring an example what you mean.
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net
>
> "shapper" <mdmo...@gmail.com> wrote in message
>
> news:2d5e3845-3861-49ec-8ed3-c525d18d8ce9@b1g2000hsg.googlegroups.com...
>
> > Hello,

>
> > I am checking a DateTime variable to check if in range: low <
> > MyDateTime < high.

>
> > However, I know need do the same but not care about the year. Can I do
> > this?

>
> > Thanks,
> > Miguel


Well, consider the following two dates:

Start:
2007-09-08 11:29:50

Finish:
2007-10-12 12:30:20

Then the test date:
2008-09-22 08:29:50

The test date is between the other two dates if you don't consider the
year. That is what I need to test.

Thanks,
Miguel


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 02:37 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.