test.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // const getBase64 = (url, ext, callback) => {
  2. // let canvas = document.createElement('canvas')
  3. // const ctx = canvas.getContext('2d')
  4. // const img = new window.Image()
  5. // img.crossOrigin = 'Anonymous'
  6. // img.src = url
  7. // img.onload = function() {
  8. // canvas.height = 60
  9. // canvas.width = 85
  10. // ctx.drawImage(img, 0, 0, 60, 85)
  11. // const dataURL = canvas.toDataURL('image/' + ext)
  12. // callback.call(this, dataURL) // 回掉函数获取Base64编码
  13. // canvas = null
  14. // }
  15. // }
  16. //
  17. // getBase64('https://minio.xxx.com:9001/tenant-9999/v2-db4968b9166990ca91ed7751ac19afdd_r_20231113152749A010.webp', 'webp', (res) => {
  18. // console.log('res', res)
  19. // })
  20. // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//根据自己情况
  21. // String date="2019-07-26 15:21:00";
  22. // Date dd=sdf.parse(date); //String转Date
  23. // const date = new Date('2019-07-26 15:21:00')
  24. // console.log(date.getHours())
  25. // console.log(date.getSeconds())
  26. //
  27. // const dateY = new Date('2012-2-2 08:54:32')
  28. // console.log('指定时间', dateY) // Thu Feb 02 2012 08:54:32 GMT+0800 (中国标准时间)
  29. // import moment from 'moment/moment'
  30. import moment from 'moment'
  31. console.log('--', new Date('2023-12-11 03:00:99'))
  32. console.log('--', new Date())
  33. console.log('2023-10-24T16:00:00.000Z', moment('2023-10-24T16:00:00.000Z').format('yyyy-MM-DD'))