Showing posts with label isdate. Show all posts
Showing posts with label isdate. Show all posts

Tuesday, 19 February 2013

ASP: CDate

   


CDate is an ASP function that converts a valid date and time string to a Date Type value and returns it.

Because of the above we need to use another ASP function in order to be sure to convert a valid date. The function's IsDate.

In the following short post, we are going to see how to use both functions and create a short script that converts a date.

Monday, 14 November 2011

ASP: how to create effective date fields for forms

   


Today we are going to create a date field for a form. The goal is to make it beautiful to see, easy to use and with validation. We are going to use ASP and just a touch of CSS.
The form element will look like:



In the example above, I have inserted all the options manually, but as I will show you, we are going to make the values of the three option controls automatic. - Note that if you are reading this post via your RSS reader you might not see the above example in the way it was meant.

Ok. Let's start with the code.

Friday, 22 April 2011

ASP: is this a date? The IsDate function

   


Form validation is probably the most wanted feature by web developers. Every web programmer, at least once in a lifetime, has dealt with the issue: the user fills in the form and submit wrong data. Without validation, the best thing could happen is that an error is thrown. The worst case? The wrong data is submitted to your database... and believe me, most of the time you don't want that.
While complete JavaScript form validation solutions are available everywhere, today I would like to point out that VBScript has a very simple function that can help us in checking dates at least.

The function
The function I am talking about is IsDate. I've already talked about the function in a post about SQL Server queries and date functions. The VBScript function works in a similar way.
Basically it returns a Boolean value (true/false) stating if an expression is a date or can be converted to a date. The function uses the local settings in the evaluation process, so be careful in using it: for example, English months in words are not the same in Italian.

Friday, 10 December 2010

SQL Server: basic functions (part 7) - IsNull, IsNumeric, IsDate

   


This is the seventh part of the Sql Server basic functions series. When I started it, I couldn't think of going that far. Honestly, I thought I would write about some functions, however, after a while, I started to understand that leaving other functions out would be unfair. That's why I would like to write about IsNull, IsNumeric and IsDate... and maybe some other functions in the near future.