string[] ar1=current1.Split('/');
string ar2=ar1[2];
I am getting error like this.Index was outside bounds of the array @last line
If i put same code in IIS
string current1="02/02/1988";
string[] ar1=current1.Split('/');
string ar2=ar1[2];
I am not getting any error
Could you please solve above problem?.
If i put this code as normal like this
string current1="02/02/1988";
string[] ar1=current1.Split('-');
string ar2=ar1[2];
sometimes i am getting error and sometimes not getting error
Selva GanapathyPosted Feb 24, 2014, 11:00 AM
Seems you are trying to get year seperated from in an DateTime formate. Why cant you try the following code snippet to achieve your requirement?
string ar2 = DateTime.Now.Year;
Regards,
Selva Ganapathy K
Jignesh TrivediPosted Feb 24, 2014, 11:35 PM
hi,
I think, this problem of culture. It might be possible your separator is '-' and you are trying to split it by '/'...
VulpesPosted Feb 24, 2014, 10:44 AM
I'd try putting the break-point earlier in the code and then 'single step' from there to see if you can figure out if and why it's being by-passed.
Sasi ReddyPosted Feb 21, 2014, 11:50 PM
VulpesPosted Feb 21, 2014, 5:50 AM
Sasi ReddyPosted Feb 21, 2014, 5:12 AM
Lakshmanan Sethu SankaranarayanPosted Feb 21, 2014, 5:00 AM
Sasi ReddyPosted Feb 21, 2014, 3:55 AM
string current1="02/02/1988";
string[] ar1=current1.Split('-');
string ar2=ar1[2];
and i am getting index was out of bounds of array
Lakshmanan Sethu SankaranarayanPosted Feb 21, 2014, 3:41 AM
Sasi ReddyPosted Feb 21, 2014, 3:04 AM
Lakshmanan Sethu SankaranarayanPosted Feb 21, 2014, 2:59 AM
Sasi ReddyPosted Feb 21, 2014, 2:56 AM
Lakshmanan Sethu SankaranarayanPosted Feb 21, 2014, 2:32 AM