\t    \t        Select the Date  \t        \t    \t   \t   \tThis will work for you.   \t   \tRegards,   \tDeepak", "upvoteCount": 1, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8CqESAV", "datePublished": "2013-05-07T06:35:56.000Z", "author": { "@type": "Person", "name": "Deepak K Anand", "url": "https://trailblazers.salesforce.com/profileView?u=00530000007r9WpAAI", "affiliation": { "@type": "Organization", "name": "‎‎‎‎‎‎Zoom Communications, Inc." } } } ] } }
Skip to main content

hi friends,

 

I need Date picker field in visualforce page.

 

When select that field the date format should like YYYY-MM-DD

 

How to achieve this?

 

Thanks for all your response

1 个回答
  1. 2013年5月7日 06:35
    Hey Arun,

     

    Try this:

     

    <apex:page>

        <script>

            function formatDate()

            {

                if(document.getElementById('date-input').value!='')

                    document.getElementById('date-input').value = 

                        new Date(document.getElementById('date-input').value).toISOString().split('T')[0];

            }

        </script>

        <apex:form>

            Select the Date&nbsp;

            <input 

                    id="date-input"  

                    type="input" 

                    onFocus="DatePicker.pickDate(false, 'date-input', true);" 

                    onBlur="return formatDate();"

            />

        </apex:form>

    </apex:page>

     

     

    This will work for you.

     

     

    Regards,

     

    Deepak
0/9000