3 Replies Latest reply on Aug 27, 2010 12:27 PM by ZeKid

    How do I display the date only

    Jerry62712 Level 1

      I've found several near misses on this subject.  How do I get the DateField to display only the date and not the time?

        • 1. Re: How do I display the date only
          ShardulSingh Level 3

          Pls try something Like this. :-

           

                  var date : Date = new Date()
                  var currentDateStr : String = String(date.getDate() + "/" + date.month + "/"+ date.getFullYear());
                  Alert.show(currentDateStr);

           

           

           

           

           

          with Regards,

           

           

          Shardul Singh Bartwal

          • 2. Re: How do I display the date only
            Jerry62712 Level 1

            Sorry for the slow response,  Had a hot potato I had to deal with.

             

            I probably wasn't clear.  We have a datefield on the form.  We populate it from a database.  The field has a format code of MM/DD/YYYY in it, but the time keeps coming up when populated.  I don't want to see the time at all.

             

            From the language ref 3.5:

             

            formatStringproperty

            formatString:String

            The format of the displayed date in the text field.       This property can contain any combination of "MM",        "DD", "YY", "YYYY",       delimiter, and punctuation characters.

            The default value is "MM/DD/YYYY".

            • 3. Re: How do I display the date only
              ZeKid

              Try this for the selectedDate attribute of the DateField tag:

               

              selectedDate = " { myD

              ateString != '' ? new Date( myDateString ) : null } "