CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP.NET - InMotion Framework

 Problem with dates

Print topic Send  topic

Author Message
AndyGB4

Posts: 122
Posted: 03/07/2013, 2:25 PM

I'm trying to get Today's date, and add 30 days to it.
I found some documentation to help me out with that, but I keep getting this error any time I try to get today's date. (Error on line 1730)

Index was outside the bounds of the array.   
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.IndexOutOfRangeException: Index was outside the bounds of the array.   
  
Source Error:   
Line 1728: parts[0] = CurrentDate.Year.ToString("0000");  
Line 1729: }   
Line 1730: if (!DateTime.TryParseExact(parts[1], "MM", System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat, System.Globalization.DateTimeStyles.None, out dummyDate))   
Line 1731: {   
Line 1732: parts[1] = CurrentDate.Month.ToString("00");   
  
Source File: c:\inetpub\Viniserve\App_Code\InMotion\Web\Controls\Calendar.cs Line: 1730

I've tried so many ways, using MTDateTime or just Date, and retrieving DateTime.Now, but I always get an Index Out of Bounds error... So I'm guessing it has something to do with "parts[1]".

Any ideas?
View profile  Send private message
cvboucher

Posts: 191
Posted: 03/07/2013, 5:52 PM

My guess is that the date parameter isn't formatted right. It needs to be YYYY-MM. If the MM doesn't exist then there won't be a parts[1].

Use AddDays to add 30 days.

DateTime.Now.AddDays(30).ToString("yyyy-MM")
Just in case you really want the next month you can do the following.

DateTime.Now.AddMonths(1).ToString("yyyy-MM")

Craig
View profile  Send private message
AndyGB4

Posts: 122
Posted: 03/07/2013, 5:54 PM

This is too funny! you answered my question the minute I figured it out! :)

Thanks anyways. I figured it out by going and look into the Calendar.cs class and checking out what it was supposed to be doing.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.