473,387 Members | 1,606 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,387 software developers and data experts.

subtracting days from date

hI,
i AM TRYING TO SUBTRACT DAYS FROM PARTICULAR DATE. i KEEP GETTING THE ERROR:
hERE IS MY CODE: enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
I AM USING C# AND THE ERROR IS:
Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Ticks must be between
DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks

Source Error:

cAN SOMEONE HELP
Nov 18 '05 #1
5 2685
tempDate = System.DateTime.Now;
enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
"Manny Chohan" wrote:
hI,
i AM TRYING TO SUBTRACT DAYS FROM PARTICULAR DATE. i KEEP GETTING THE ERROR:
hERE IS MY CODE: enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
I AM USING C# AND THE ERROR IS:
Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Ticks must be between
DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks

Source Error:

cAN SOMEONE HELP

Nov 18 '05 #2
my complete code is follows:
tempDate=Convert.ToDateTime(Calendar2.TodaysDate.T oShortDateString());

enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
It still give me error. I am using c#.
Thanks
Manny

"vinay" wrote:
tempDate = System.DateTime.Now;
enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
"Manny Chohan" wrote:
hI,
i AM TRYING TO SUBTRACT DAYS FROM PARTICULAR DATE. i KEEP GETTING THE ERROR:
hERE IS MY CODE: enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
I AM USING C# AND THE ERROR IS:
Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Ticks must be between
DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks

Source Error:

cAN SOMEONE HELP

Nov 18 '05 #3
Which event are you checking the values??
post the full code.

"Manny Chohan" wrote:
my complete code is follows:
tempDate=Convert.ToDateTime(Calendar2.TodaysDate.T oShortDateString());

enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
It still give me error. I am using c#.
Thanks
Manny

"vinay" wrote:
tempDate = System.DateTime.Now;
enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
"Manny Chohan" wrote:
hI,
i AM TRYING TO SUBTRACT DAYS FROM PARTICULAR DATE. i KEEP GETTING THE ERROR:
hERE IS MY CODE: enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
I AM USING C# AND THE ERROR IS:
Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Ticks must be between
DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks

Source Error:

cAN SOMEONE HELP

Nov 18 '05 #4
thanks Vinay, here is the code:

if(!Page.IsPostBack)
{
Get_Appointments();
tempDate=Convert.ToDateTime(Calendar2.TodaysDate.T oShortDateString());

}
public void MonthChanged(object sender, MonthChangedEventArgs e)
{
//Set the tempDatevariable to the value in the MonthChangedEventArgs
NewDate property
tempDate = e.NewDate;
//Reload the collection
Get_Appointments();
}

ICollection Get_Appointments()
{

DateTime startDate = new DateTime(2004,11,1);
DateTime endDate = new DateTime(2004,12,1);

enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);

Rest follows the custom code as i am working with vendor API. Please let me
know if this is enough.

Thanks

Manny

"vinay" wrote:
Which event are you checking the values??
post the full code.

"Manny Chohan" wrote:
my complete code is follows:
tempDate=Convert.ToDateTime(Calendar2.TodaysDate.T oShortDateString());

enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
It still give me error. I am using c#.
Thanks
Manny

"vinay" wrote:
tempDate = System.DateTime.Now;
enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
"Manny Chohan" wrote:

> hI,
> i AM TRYING TO SUBTRACT DAYS FROM PARTICULAR DATE. i KEEP GETTING THE ERROR:
> hERE IS MY CODE: enddatecriteria=tempDate.AddDays(30);
> startdatecriteria=tempDate.AddDays(-30);
> I AM USING C# AND THE ERROR IS:
> Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
> Parameter name: ticks
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information about
> the error and where it originated in the code.
>
> Exception Details: System.ArgumentOutOfRangeException: Ticks must be between
> DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks
>
> Source Error:
>
> cAN SOMEONE HELP

Nov 18 '05 #5
Manny, looks like your tempdate is empty when you do the startdatecriteria=
(you're trying to back off 30 days from what's already the date.minvalue).
I'd trace backwards from there and look at calendar2.todaysdate and
e.newdate. hth

"Manny Chohan" wrote:
thanks Vinay, here is the code:

if(!Page.IsPostBack)
{
Get_Appointments();
tempDate=Convert.ToDateTime(Calendar2.TodaysDate.T oShortDateString());

}
public void MonthChanged(object sender, MonthChangedEventArgs e)
{
//Set the tempDatevariable to the value in the MonthChangedEventArgs
NewDate property
tempDate = e.NewDate;
//Reload the collection
Get_Appointments();
}

ICollection Get_Appointments()
{

DateTime startDate = new DateTime(2004,11,1);
DateTime endDate = new DateTime(2004,12,1);

enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);

Rest follows the custom code as i am working with vendor API. Please let me
know if this is enough.

Thanks

Manny

"vinay" wrote:
Which event are you checking the values??
post the full code.

"Manny Chohan" wrote:
my complete code is follows:
tempDate=Convert.ToDateTime(Calendar2.TodaysDate.T oShortDateString());

enddatecriteria=tempDate.AddDays(30);
startdatecriteria=tempDate.AddDays(-30);
It still give me error. I am using c#.
Thanks
Manny

"vinay" wrote:

> tempDate = System.DateTime.Now;
> enddatecriteria=tempDate.AddDays(30);
> startdatecriteria=tempDate.AddDays(-30);
>
>
> "Manny Chohan" wrote:
>
> > hI,
> > i AM TRYING TO SUBTRACT DAYS FROM PARTICULAR DATE. i KEEP GETTING THE ERROR:
> > hERE IS MY CODE: enddatecriteria=tempDate.AddDays(30);
> > startdatecriteria=tempDate.AddDays(-30);
> > I AM USING C# AND THE ERROR IS:
> > Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
> > Parameter name: ticks
> > Description: An unhandled exception occurred during the execution of the
> > current web request. Please review the stack trace for more information about
> > the error and where it originated in the code.
> >
> > Exception Details: System.ArgumentOutOfRangeException: Ticks must be between
> > DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name: ticks
> >
> > Source Error:
> >
> > cAN SOMEONE HELP

Nov 18 '05 #6

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

Similar topics

11
by: Laery | last post by:
Hi, I'm currently adding a new module to an old borland C3.1 application (dos). And I need to calculate a date by subtracting the number of days from a given date. I know I could use an...
6
by: Brian Henry | last post by:
How would i take two dates startdate and enddate and subtract startdate from enddate to figure the number of days between the two? thanks
9
by: Mike Fellows | last post by:
i have 2 dates one is todays date and the other is a future date i want to take todays date from ther future date and tell me how many days difference this is thanks in advance Mike...
8
by: Ifollowhim | last post by:
I have a (installation) date in a table that I put in manually. It is the date we want to complete a job. In a form that uses data from that table I want to add a text box that is bound to the...
3
by: Jim in Arizona | last post by:
I'm having difficulty figuring out how to find the date three days from today's date. I'm trying to use an sql select statement, like so: "SELECT * FROM TableA " & _ "WHERE DateColumn BETWEEN...
1
by: LisaY | last post by:
I have a date listed in one cell and I want to subtract 3 business days from that date excluding holidays. Does anyone know how that would be done? Will "NETWORKDAY" function work?
2
by: kid | last post by:
hi, i need help i want to subtact 30 days from current date. here is my sample code but its not working. var currentTime = new Date() var month = currentTime.getMonth() + 1 var day =...
0
by: ananthaisin | last post by:
I am having the below oracle statement TO_DATE(to_char(last_day(add_months(sysdate-1,-1))+1,'dd-mon-YYYY'),'dd-mon-YYYY')-ACT_DATE to update a column... But in Db2 this does not work,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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.