Scenario I got while developing some application. I required month and year view in drop down list between contract starting and ending date. Like “March 2009” “April 2009” until march 2011 so on.
I handled it as follow
DateTime _LoopDate = “1/1/2009”;
[...]
Read Full Post »
Hi i found two methods to do so.
Using Globliziation
System.Globalization.DateTimeFormatInfo d = new System.Globalization.DateTimeFormatInfo();
string month = d.MonthNames[DateTime.Now.Month-1];
Using new date object as follow
string MonthName = GetMonthName(DateTime.Now.Month);
static string GetMonthName(int monthNum)
{
return GetMonthName(monthNum, false);
}
static string GetMonthName(int monthNum, bool abbreviate)
{
if (monthNum < 1 || monthNum > 12)
throw new ArgumentOutOfRangeException(“monthNum”);
DateTime date = new DateTime(1, monthNum, 1);
if (abbreviate)
return date.ToString(“MMM”);
else
return date.ToString(“MMMM”);
}
Chears
Read Full Post »
Posted in 1 on March 17, 2009 | Leave a Comment »
pl Sql has function “Extract” this functions works wonders. I used it at many places in my application , i write some samples here
Years
select EXTRACT(YEAR FROM DATE ‘2008-3-17′)YEAR from dual;
Months
select EXTRACT(Month FROM DATE ‘2009-3-17′)Months from dual;
Day
select EXTRACT(day FROM DATE ‘2009-3-17′)Days from dual;
and [...]
Read Full Post »
i found a use full regular expression vaildating input string, you can use it to filter sql injection attacks while taking input for username, title ect.
^[a-zA-Z]+(([\.\- ][a-zA-Z0-9 ])?[a-zA-Z0-9]*)*$
Read Full Post »
Posted in 1 on March 2, 2009 | Leave a Comment »
the poem by faiz ahmed faiz constantly comes in my mind. Check it out
Chashm-e-nam,Jaan-e-Shorida kaafi nahiNTohmat-e-Ishq posheeda kaafi nahiNAaj Bazaar meiN pabajaulaN chaloDast afshaaN chalo, mast-o-raqsaaN chaloKhaak barsar chalo,khuN badamaaN chaloraah takta hai sab shehr-e-jaanaN chaloAaj bazaar meiN pabajaulaN chalohaakim-e-sheher bhi majama�e aam bhisubh-e-nashad bhi,roz-e-nakaam bhiteer-e-ilzam bhi sange dushnam bhipa ba jaulaaN chalo, aaj [...]
Read Full Post »