方法functionformattimedetail timestamp ) if ! isnantimestamp ) ) consttimestamptotime=timestamp ) ) const date=new date timestamp ); //时间戳要达到10位*1000,时间戳为13位时,1000 const Y=date.getFullYear ); Constm=date.getmonth ) )1 10? ‘0’date.getmonth1) : date.getMonth ) ) 1; const D=date.getDate ; const h=date.getHours ) ) 10? ‘0’ date.getHours ) : date.getHours ); const m=date.getMinutes ) 10? ‘0’ date.getMinutes ) : date.getMinutes ); const s=date.getSeconds ) 10? ‘0’ date.getSeconds ) : date.getSeconds ); 返回y ‘年’ m ‘月’ d ‘日’ ‘ h ‘:’ m ‘:’ s; ; 常数新=新日期timestamp; //日期const nowDayOfWeek=now.getDay ; //每周的第几天constnowdayofhours=now.get hours ; //第几个小时const weekFormat={ 1: ‘星期一’,2: ‘星期二’, ‘星期三’,4: ‘星期四’,5: ‘星期六’,0: 常数week=week format [ now day ofweek ]; let timeProgress=’ ‘; if nowdayofhours=1nowdayofhours=5) { timeProgress=’北京时间凌晨’; } else if 新天堂5新天堂=6) { timeProgress=’北京时间清晨’; } else if nowdayofhours6nowdayofhours=11 ) { timeProgress=’北京时间早晨’; } else if nowdayofhours 11 nowdayofhours=13 ) { timeProgress=’北京时间中午’; } else if nowdayofhours 13 nowdayofhours=17 ) {时间进度=’北京时间下午’; } else if nowdayofhours 17 nowdayofhours=18 ) {时间进度=’北京时间傍晚’; } else if nowdayofhours 18 nowdayofhours=24 ) { timeProgress=’北京时间晚’; } else { timeProgress=’北京时间午夜’; } const cdata={ ‘date’: date,’ week’: week,’ time progress ‘ : time progress }; 返回数据; } else { return ‘ ‘; }; 调用和打印eg:
相关文章
OpenAI网络韩国站:LG电子获大奖,三星电子获最优秀奖
2026年11月29日大疆Neo 3配套RC Mini控制器现身FCC,配1.97英寸屏和1950mAh电池
2026年11月29日格力董明珠称年底将推奢侈品级家电 计划主打十年保值
2026年11月29日Galaxy S27机模曝光:摄像头改为横向并新增Pro机型
2026年11月29日厨电行业进入价值深耕新周期 凯度承办行业年会分享转型样本
2026年11月29日蔚来宣布江苏换电站突破500座 累计换电服务1950万次
2026年11月28日
评论
站内搜索
热门文章
友情链接
- 科技博客
- 文本分割器
- 房贷计算器
- 存款利率计算器
- 反应速度测试
- 舒尔特方格
- mx记录查询
- 尺子在线测量
- 国旗图片大全
- 贷款计算器
- 日期计算器
- 孕周计算器
- 在线秒表
- Favicon Generator
- 超小厨美食
- Morse Code Translator
- national flag
- email tools
- market hours
- regex generator
- 科技博客
- 娱乐八卦
- free image compressor
- how to delete
- just delete me
- play piano
- 风君网络
- easy piano songs
- symbol
- online counter
- wiztree
- wiztree download
- online scoreboard
- 7zip download
- sharex download
- bandizip
- password remover
- bitumen calculator
- Asphalt Calculator
- random pokemon generator
- vlc播放器
- Electricity Bill Calculator
- Elven Name Generator
- Car logos
- stadium view
- voidimageviewer
- space bar clicker
- starbucks nutrition calculator
- cooking calculator
- Country Drawing
- World TV channels
- 短剧大全
- lagos life simulator
- Unicode to Bamini Converter
- medal bypass
发表回复