CFINPUT Date Question

Posted on 2005-04-28
Medium Priority
Last Modified: 2010-05-19
The users want to beable to enter on the first part of the date (04/26) and have they system enter the right year in to the field. I was wondering if any one have a clue on how to do this.

thank you
Question by:ToddAP79
LVL 12

Accepted Solution

Preece earned 375 total points
ID: 13887815
In vb, I would do this, on the lost focus or via a button:

    txtDate = Format(txtDate & "/" & Format(Now, "yyyy"))


    txtDate = Format(txtDate & "/" & Format(Now, "yy"))

The Format(Now, "yyyy") will return the system year, but you are depending upon the date and time to be correct on that and each pc...

Also, this is assuming that the user types in mm/dd, and nothing more.  You may want to do a validation, something like:

    If IsDate(Format(txtDate & "/" & Format(Now, "yyyy"))) Then
        txtDate = Format(txtDate & "/" & Format(Now, "yyyy"), "mm/dd/yyyy")
    End If

Hope this helps!

Author Comment

ID: 13889042
i used the format that Preece gave and it worked

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question