CFINPUT Date Question

Posted on 2005-04-28
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

    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

    i used the format that Preece gave and it worked

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    format the code in java 6 60
    ImportError: No module named 'pypyodbc' - python 3.5.2 3 246
    MaxSpan challenge 9 50
    wordlen challenge 3 29
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now