Skip to main content
Known Participant
June 9, 2009
Question

validate date in coldfusion or javascript???

  • June 9, 2009
  • 1 reply
  • 1093 views

Hi,

I had a form that contains date field and user enters date as 06/09/2009,but when user enters date in the date field the date field has to be validate to the last day of that month.

For example if i enters 06/09/2009 then it has to validate for the month 06 and no of days in that month.

After validation i have to set that last day of month as the expiration date for the gift card.

Would please help me in this i have no idea in this

Thanks.

This topic has been closed for replies.

1 reply

Inspiring
June 10, 2009

Hi,

Use DaysInMonth() function and find the number of days in month.

For finding last date of month use follwing code.

<cfset currentMonthDate = CreateDate(year(Now()),month(dateAdd('m',1,Now())),1)>


<cfset lastDayOfMonth = dateAdd('d',-1,createdNextMonthDate)>

Thanks