jsp頁面中日期的格式化

來源:互聯網
上載者:User

標籤:分享   put   資料   lan   直接   int   orm   pat   改變   

        在一次開發中,由於資料庫中生日採用的是datetime的資料類型,因此資料庫中資料格式為:2017-07-11 00:00:00。但是,編輯頁面中回顯生日肯定是不可以顯示出時分秒的,只能顯示2017-07-11這種格式;如果不處理的話,回顯的資料就有問題。在不改變資料庫結構的情況下,我們直接在jsp頁面中對回顯的資料格式化,採用<fmt:formatDate/> 標籤。
        代碼如下:
 
  1. <input type="text" id="birthday" name="user.birthday"
  2. value="<fmt:formatDate value=‘${user.birthday}‘ pattern=‘yyyy-MM-dd‘/>"
  3. class="Wdate"
  4. onfocus="WdatePicker({
  5. lang:‘zh-cn‘,
  6. skin:‘whyGreen‘,
  7. dateFmt:‘yyyy-MM-dd‘,
  8. readOnly:true
  9. })"
  10. />

    :             

jsp頁面中日期的格式化

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.