Date field in Visualforce

So I’ve ran into this a couple times…I want a date field on my VF page, but its a standalone field….doesn’t belong on an object.  I searched online and between a few posts (namely discussion boards) I found some javascript…so here it is.

On your VF page:

Top of page, or where you want your script statements:

<script>function PageDatePicker(dateId){DatePicker.pickdate(false,dateId.Id,false);}</script>

Then at your inputtext for the date:

<apex:inputtext id=”dateInput” value=”{!randomDate}” onfocus=”PageDatePicker(this);” onchange=”checkdateformat(this.id);”/>