CodeCharge Studio
search Register Login  

Web Reporting

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

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

 Date Calculating Functions

Print topic Send  topic

Author Message
duplo1

Posts: 67
Posted: 04/27/2009, 9:40 AM

I need to calculate a date field for an Asp.net C# INMOTION project. The standard asp.net coding does not work, and Inmotion is not documented at all.

Here is what I would need:

When a registration field is completed, it should automatically calculate an expiration date based on Current Date + 30 Days.

I have tried:
Corporate_Addresses.GetControl<MTTextBox>("Plan_Expiration").Text = DateTime.Now.ToString() + 30;

I dont get an error, but the default value is displayed as "4/25/2009 8:11:21 PM30"

Anyhelp is much appreciated.

Christoph
View profile  Send private message
vsuarez

Posts: 8
Posted: 04/27/2009, 10:30 AM

Hi Christoph,

You are concatenating strings instead of adding days. To add days you may use something like:

theNewDate = DateTime.Now.AddDays(30);

In your example:

Corporate_Addresses.GetControl<MTTextBox>("Plan_Expiration").Text = DateTime.Now.AddDays(30).ToString();

If you want your new date not to fall in a holiday, you may also use something like:

while (theNewDate.DayOfWeek == DayOfWeek.Saturday || theNewDate.DayOfWeek == DayOfWeek.Sunday) {
theNewDate.AddDays(1);
}


Regards,

Victor
View profile  Send private message
duplo1

Posts: 67
Posted: 05/04/2009, 9:59 AM

Thank you so much, Victor.

It worked great.

C.
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.

Web Database

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.