|
how can i find number of days in a given year and month
|
|
|
|
|
Number of days in a year is a constant (varies for a leap year). Number of days in any given month is going to be a constant (except for February in a leap year). Which part of this are you having a difficulty with?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
thank you for your replay and you solved the problem and i remembered that if we want to know if February in a leap year or not by divided the year by 4 and if the result is an integer number it will be leap year such as 2004/4=501 this is a leap year and 2005/4=501.25 it's not a leap year
and i'll to try it by code
Many thanks for all
modified on Tuesday, June 2, 2009 3:48 AM
|
|
|
|
|
Ooh - not quite. If it's a century, it has to be divisible by 400 to be a leap year, so 2000 is a leap year and 2100 isn't.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Let us hope that his code will not have to run for a century.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
is 2100 really not a leap year?
EDIT: It's OK I WIKI it and got an answer
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
use modulus (provides the remainder after a division) not divide...
if(year % 4 == 0)
else
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Many Thanks and i'm very happy from Your cooperation
|
|
|
|
|
Ok this is what you should use instead...
if(year % 4 == 0 && year % 100 == 0 ? year % 400 == 0 : true)
else
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
you realy have come to the right solution
thank you
|
|
|
|
|
Or if you don't want to reinvent the wheel:
if (DateTime.IsLeapYear(year)) {
} else {
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I think we all need new wheels
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
int daysInMonth = DateTime.DaysInMonth(2009, 2);
Console.WriteLine(daysInMonth);
|
|
|
|
|
i don't know if the user will enter 2009 or 2008 or any month i want to take the data from the user
modified on Tuesday, June 2, 2009 4:19 AM
|
|
|
|
|
Then you just use variables in the call to the DaysInMonth method instead of the literal values used in the example.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Have a look at this:
private void button1_Click(object sender, EventArgs e) {
button1.Enabled = false;
int year = dateTimePicker1.Value.Year;
int month = dateTimePicker1.Value.Month;
DateTime start = new DateTime(year, month, 1);
dateTimePicker1.Value = start;
int days = DateTime.DaysInMonth(year, month);
for (int i = 0; i < days; i++) {
dataGridView1.Rows.Add();
dataGridView1.Rows[i].Cells[0].Value = start.AddDays(i).DayOfWeek;
dataGridView1.Rows[i].Cells[1].Value = start.AddDays(i).ToShortDateString();
}
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
a very Clever man this what i want to reach thank you
|
|
|
|
|
Hi =),
I want to draw the content of a pdf or postscript file on on a graphics object.
I searched already, but i just found nothing useful.
Does anyone of you know how to do that ?
thanks in advance.
|
|
|
|
|
I want the browser(IE) to show empty in its window intially for a particular period of time,
How can I do this in c#?
Normally in VC, WM_PAINT is the message that makes a request to paint a portion of an application's window.
In c#, How can I paint the a portion of IE window?
Is there any other methods to achieve this?
|
|
|
|
|
Hello experts
I am deploying project1 which contain another 2 projects.when i finish setup and run it then that another 2 project forms not working.Is there any mistake done by me while deploying it?
tel me,project at finish line,Fast.
|
|
|
|
|
Good morning KIDYA
I you have a Solution with Two Projects , atleast one must Depends on another one, lets take an example
i have a Solution with a Website and a Class Project named (DAL) and another Class Project named(BLL), So you have to set a reference in the BLL Project to DAL and add a reference of a BLL in the Website.And when i create a Setup project Everything will work, i suspect that you did not add references to your Project.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi all,
I need to execute a perl application from c#.net.
There is a perl application,It accepts 4 parameters and display the result.
Please guide me for below points
1.How to execute the perl application from C#.net?
2.How to pass the parameters to perl application from c#.net?
Please help me..
thanks in advance
|
|
|
|
|
Is that a problem for you: Link[^]
|
|
|
|