473,847 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding month to dropdownlist if next month will start in 5 or less days

parshupooja
159 New Member
Hey,

I have dropdownlist where I am adding 2 values:

Expand|Select|Wrap|Line Numbers
  1. DDCycle.Items.Add(new ListItem(DateTime.Now.AddMonths(-1).ToString("MMMM"), DateTime.Now.AddMonths(-1).ToString("M/yy")));
  2. DDCycle.Items.Add(new ListItem(DateTime.Now.ToString("MMMM"), DateTime.Now.ToString("M/yy")));
I want to add below value if next month is about start in 5 or less days :

Expand|Select|Wrap|Line Numbers
  1.  DDCycle.Items.Add(new ListItem(DateTime.Now.AddMonths(1).ToString("MMMM"), DateTime.Now.AddMonths(1).ToString("M/yy")));
Any idea?

Thanks
Feb 28 '08 #1
2 1169
balabaster
797 Recognized Expert Contributor
Hey,

I have dropdownlist where I am adding 2 values:

Expand|Select|Wrap|Line Numbers
  1. DDCycle.Items.Add(new ListItem(DateTime.Now.AddMonths(-1).ToString("MMMM"), DateTime.Now.AddMonths(-1).ToString("M/yy")));
  2. DDCycle.Items.Add(new ListItem(DateTime.Now.ToString("MMMM"), DateTime.Now.ToString("M/yy")));
I want to add below value if next month is about start in 5 or less days :

Expand|Select|Wrap|Line Numbers
  1.  DDCycle.Items.Add(new ListItem(DateTime.Now.AddMonths(1).ToString("MMMM"), DateTime.Now.AddMonths(1).ToString("M/yy")));
Any idea?

Thanks
Expand|Select|Wrap|Line Numbers
  1. If Now.Day >= (Date.DaysInMonth(Now.Year, Now.Month) - 5) Then
  2.     DDCycle.Items.Add(....)
  3. End If
This will do something if the day of the month is greater than the number of days in the current month less five.
Feb 28 '08 #2
parshupooja
159 New Member
Thanks, it worked great

Expand|Select|Wrap|Line Numbers
  1. If Now.Day >= (Date.DaysInMonth(Now.Year, Now.Month) - 5) Then
  2.     DDCycle.Items.Add(....)
  3. End If
This will do something if the day of the month is greater than the number of days in the current month less five.
Feb 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2507
by: sandy | last post by:
Hello, I am trying to automate a date. When typing in the issue date I want it to automatically calculate 6 months fronm the issue date and give me the Expiration date. Following is code that I am using: <td>Visa Issued Date:</td> <td><input name="visaIssueDate" type="text" size="8" maxlength="8" value="#DateFormat(get_NamesContacts.VisaIssueDate, 'mm/dd/yy')#" onBlur="checkDate(this)"></td> <td>Expiration Date:</td>
7
8774
by: John Baker | last post by:
HI: I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month. Is there a simple way to increment dates by a...
7
2044
by: Lastie | last post by:
Hi all, I’ve got a ‘dropdownlist’ web control and I can add ‘listitem’ no problem. I can also bind data from an SQL database fine. My problem is that I want to do both at the same time to allow me to have the first option in the list a ‘listitem’ saying something like ‘please pick an option’, and then the rest of options coming from the database. <asp:dropdownlist id="fm_Category" runat="server"...
4
4448
by: J-P-W | last post by:
Hi, I have a system that records insurance policies. If the policy is cancelled then any part of a month insured is deducted from the premium, so a policy that ran for 32 days would get a 10 month rebate so would 58 days etc. I've used:
9
3684
by: AideenWolf | last post by:
Windows XP - Access 2003 I've been researching this for about 3 weeks now and I'm no closer then when I started so any help you all give me will save my hair. I'm VERY new and learning as I go so bare with me. What I want to do is generate a new record for each date an event is held on. The events are reoccuring events. Daily, weekly, etc. What I've done so far: I have a foum that the user enters the Start date and End Date.
6
3274
by: Zeba | last post by:
Hi, I have a page with a calendar and two datalist items - one containing month values and the other, year values. Depending on the month/year value chosen ( in text/string format ) I should be able to display the correct month of the calendar. I thought it would be possible to use the OnSelectedIndexChanged attribute of the dropdown list to call a javascript function that sets the month value of the calendar...Something like :
6
11550
by: Yinghe Chen | last post by:
Hi, Could someone help on how to use python to output the next month string like this? "AUG07", suppose now is July 2007. I think also need to consider Dec 07 case, it is supposed to output as below: "JAN07".
6
1977
nomad
by: nomad | last post by:
Hello Everyone: I'm having troubles with some coding and Idon't know where it is. I have delevopled a calender where the client can add events to a day. The code worked perfect on my computer but when I transfer the info I get this error. The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. If there was an error, you should be able to see...
1
4912
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the events when click on that date that perticular event displyed in a text box.But my requirement is to when click on that date that related event displyed in same td row not the text box. and also i add the events to that calendar.plz advice how to...
0
9892
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9735
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10658
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7062
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4541
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4133
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.