0

above code not working, y is 2010 and year0 is also 2010, as per my knowledge Equal should be displayed as output, but the condition does not get equal.
Pls help me for this.

year1 =rs.fields("FinYear") 
year0 = Mid(year1,1,4)'first year
year1= Mid(year1,5,4)'second year 
y = Year(Now())
if y = year0 then 
Response.Write "Equal"
Response.End 						
end if
2
Contributors
2
Replies
6
Views
6 Years
Discussion Span
Last Post by snehalj
0

Hi,
what is rs.fields("FinYear")? Is it a date? Is it the year?

I don't understand why you are using mid. If you want to extract the year from a date, simply use datepart, as following:

Response.Write DatePart("YYYY", Date())

This would result in 2010.

If this is not what you want, please let me know the value of rs.fields("FinYear").

0

hi
sorry i forget to write that,
"20102011" is get stored in FinYear or any other year in this format

year1 =rs.fields("FinYear") 
year0 = Mid(year1,1,4)'first year
year1= Mid(year1,5,4)'second year 
mon =rs.fields("iMonth")
y = Year(Now())
m = Month(Now())
if  cStr(y)= year0 then

the problem is solved using cStr function.
n by using Mid function "20102011" gets seperated as 2010 and 2011

Thank u

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.