APP Posted August 5, 2010 Share Posted August 5, 2010 We need users to be able to enter any combination of a date in a field, the results will be Long Month Name and Day. Can't seem to make this happen. For example, a user types any combination in a field of Aug 5, 2010 or 8/5/2010 or 8-1-2010 or 8-1 or 8/1 it should return the following August 5 Any ideas? I used the formate date function without the year and it works if the user includes the year in the input data field. If they don't include a year, like Aug 5 or 8-5 or 8/5, then it errors because this function needs the year and then it displays properly. We need it to just diplay August 5. Link to comment Share on other sites More sharing options...
rpaterick Posted August 5, 2010 Share Posted August 5, 2010 return FormatDate(Field("date"), "lm d"); This will work for 8/5/2010 or 8-1-2010, not the other ones though. Link to comment Share on other sites More sharing options...
Dan Korn Posted August 6, 2010 Share Posted August 6, 2010 Try this: var s = Field("date"); var date; try { date = DateFromString(s); } catch (e) { date = DateFromString(s + "/" + GetYear(Today())); } return FormatDate(date, "lm d"); Link to comment Share on other sites More sharing options...
APP Posted August 9, 2010 Author Share Posted August 9, 2010 Thanks will give it a try. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.