I think DateFormat requires a date. You are just giving it a number.

----- Original Message -----
From: "Terri Stocke" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, June 14, 2001 9:08 AM
Subject: This should be simple--why is it not working?


> Hey all,
>
> I have a dropdown list that dynamically displays the fiscal years from
1999
> up to the present fiscal year (so in this case, just 1999 and 2000. Once
> October ends, 2000 will be ended and 2001 will display in the picklist as
> well).
>
> Well, instead of the year being displayed in the list, they want the
actual
> fiscal year to be displayed in the format of 99/00, 00/01, etc. But we
would
> still pass the year as 1999, for example, for fiscal year 99/00. So the
> option VALUE would be 1999, but the DISPLAY would be FY 99/00.
>
> Okay, so that should be simple, right? I should just wrap the variable for
> display in a format mask like so:
>
> <option value="#list_year#">FY #dateformat(list_year,
> 'YY')#/#dateformat(IncrementValue(list_year), 'YY')#</option>
>
> Before I even GOT to that point, I just tested it by wrapping list_year in
a
> dateformat function like so: #dateformat(list_year, 'YY')#. BUT, this
> returns 05 for BOTH list items! Somehow CF sees the year as being 1905
when
> I wrap dateformat around it! Here is the code. Any ideas?
>
> <cfoutput>
>           <cfset first_year=1999>          <!--- The year it all began for
> the program we are reporting on --->
>           <cfset curr_year=#year(now())#>
>           <cfset list_year=#first_year#>   <!--- start picklist from the
> first year --->
>
>   <!--- If it's Jan-Oct, select previous fiscal year (previous Oct through
> to Sep)
>                 and only go up to previous fiscal year (since FY of
current
> year hasn't begun yet
>                 If it's Nov-Dec, select  current fiscal year (just started
> in Oct) and go up to
>                 current year --->
>
>           <cfif #month(now())# GT 10>
>               <cfset Select_year=#curr_year#>
>               <cfset yrs_count=#curr_year# - #first_year# + 1>
>           <cfelse>
>               <cfset select_year=#curr_year# - 1>
>               <cfset yrs_count=#curr_year# - #first_year#>
>           </cfif>
>           <select name="PARAM2">
>             <cfloop from="1" to="#yrs_count#" index="thisrow">
>               <option value="#list_year#" <cfif #list_year# EQ
> #select_year#>selected</cfif>>#list_year#</option>
>               <cfset list_year=#IncrementValue(list_year)#>
>             </cfloop>
>           </select>
>         </cfoutput>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to