473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Date 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
Sep 8 '08 #1
2 3283
Create new dates based on the month, day and use those. I would recommend
using a leap year, just in case the source was a leap year too :-)

Sep 8 '08 #2
Peter Morris wrote:
Create new dates based on the month, day and use those. I would
recommend using a leap year, just in case the source was a leap year
too :-)
Or subtract out the year, i.e.

otherDate - new DateTime(otherDate.Year, 1, 1)

or DateAdd(otherDate, 'y', -otherDate.Year) -- not sure what the new
function is for this

This keeps all the time information and so forth without having to code for
each non-year field. Note however that if you want to check the day of the
week, you'd better use the original date with the year (subtraction creates
a TimeSpan, not a DateTime with the year erased).
Sep 8 '08 #3

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

Similar topics

2
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...
8
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
1
by: sylvian stone | last post by:
Hi, I've used standard date functions in the past, but need to create something a little different, as I am working on an investment calculator. What I need to do is validate two dates, and...
5
by: RayKnight | last post by:
Is it possible for us to check if a date is valid? Should I declare the date thingy in the array? I'd want the user to check the date. Used cin, they keyed in dates like... 015204, it...
26
by: jshanman | last post by:
I am writing a timeline that uses Google Maps. I have a function that converts a date time to latitude coords. This function is used to draw the markers on the timeline. I need a reverse function...
4
by: norma.j.hildebrand | last post by:
I have a database that has a field (performance standard), every year the standard changed which was not a problem since we start out each year with a blank database and just change the standards...
10
by: kyosohma | last post by:
Hi, I am working on a timesheet application in which I need to to find the first pay period in a month that is entirely contained in that month to calculate vacation time. Below are some example...
9
by: Mo | last post by:
After a little PHP education, my first project (to get my feet wet) is making an employee time-tracking program for our small business. *** ANY SUGGESTION, THOUGHTS, OR ADVICE WOULD BE WARMLY...
6
by: tbeers | last post by:
Access 2007 I have a program that calculates time efficiencies,(charged hours vs billed hours) over a date range. The date range is entered in an input form. Works fine. My question is, can I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.