search

Home  >  Q&A  >  body text

javascript - Is there a function in jq that converts timestamp to date? It is not the kind written by myself, it is jq itself.

Asking a very simple question, is there a function in jq that converts timestamps into dates? It is not the kind I wrote myself, it is encapsulated by jq itself.

If not, I will convert it directly in php, but I still want to know if there is

迷茫迷茫2777 days ago645

reply all(5)I'll reply

  • 天蓬老师

    天蓬老师2017-05-19 10:39:39

    new Date(1492572314659).toLocaleDateString()
    
    "2017/4/19"

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-19 10:39:39

    It seems there is none. It’s all handled by myself

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-19 10:39:39

    js itself has new Date (timestamp), which creates a new date object in js. This object has getDate, getMonth, getFullYear and other methods to get the year, month and day. Please refer to the document for details: https://developer.mozilla.org ...

    Note that the timestamp of js is in milliseconds

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-19 10:39:39

    I deliberately searched the jquery source code. I did not get the date format function directly. I need to manually combine it. jq added a $.now() to get the timestamp.

    reply
    0
  • 高洛峰

    高洛峰2017-05-19 10:39:39

    jQuery-ui has a dataPicker plug-in to obtain time and configure the time output format

    reply
    0
  • Cancelreply