Swift 鏃ユ湡澶勭悊绫诲簱 Punctual.swift

Posted swift璇█

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Swift 鏃ユ湡澶勭悊绫诲簱 Punctual.swift相关的知识,希望对你有一定的参考价值。

Swift 鏃ユ湡澶勭悊绫诲簱 Punctual.swift锛屽彲浠ヤ娇鐢ㄨ嚜鐒惰瑷€瀵规棩鏈熻繘琛屾搷浣溿€傚畠鍙楀惎鍙戜簬ObjectiveSugar銆?nbsp;

涓惧嚑涓緥瀛愷煂?nbsp;

< class="item viewSource" style="width: 16px;height: 16px;color: rgb(160, 160, 160) !important;display: block !important;float: left !important;margin-left: 8px !important;overflow: hidden !important;text-indent: -5000px !important;background-image: url("https://mmbiz.qpic.cn/mmbiz_png/825xC9EGQe3SEN8rfn3IGqSAsMY6giaLYJjNiaHsufDibIiaOoRoYnJ0qhu8ib1B07loN7YSIibFH1tWI5WaxoCHyVVg/640?wx_fmt=png");background-repeat: no-repeat no-repeat !important;" title="view source">view source

< class="item printSource" style="width: 16px;height: 16px;color: rgb(160, 160, 160) !important;display: block !important;float: left !important;margin-left: 8px !important;overflow: hidden !important;text-indent: -5000px !important;background-image: url("https://mmbiz.qpic.cn/mmbiz_png/825xC9EGQe3SEN8rfn3IGqSAsMY6giaLYdjZiclNbt1j2M0U1APuTsUNibgU7yl1f2CzkFbrBQ0WicWFJbVqxPTIoQ/640?wx_fmt=png");background-repeat: no-repeat no-repeat !important;" title="print">print< class="item about" style="width: 16px;height: 16px;color: rgb(160, 160, 160) !important;display: block !important;float: left !important;margin-left: 8px !important;overflow: hidden !important;text-indent: -5000px !important;background-image: url("https://mmbiz.qpic.cn/mmbiz_png/825xC9EGQe3SEN8rfn3IGqSAsMY6giaLYiacPTibxtzUZV3UJdoFHu7voxBiccHXIuGnMiaKtthHYHicQkOsLnsZnGibA/640?wx_fmt=png");background-repeat: no-repeat no-repeat !important;" title="?">?

01 print(1.day.ago)
02 // Optional(2015-04-08 04:49:30 +0000)
03
04 print(10.days.until(Date()))
05 // Optional(2015-03-30 04:11:03 +0000)
06
07 print((1.day + 2.months - 9.years).ago)
08 // Optional(2024-02-08 18:28:26 +0000)
09
10 print(Date() - 1.day.ago!)
11
12 print(1.year.timeInterval)
13 // Optional(31622400.0)
14
15 print((Date() + 30.minutes)!.nearestHour)
16 // 1
17
18 print(4.years.fromNow?.longTimeString)
19 // Optional("12:11:44 AM EDT")
20
21 print(4.years.fromNow?.stringWithFormat("HH:mm"))
22 // Optional("00:11")


寮€婧愪唬鐮侀〉锛歨ttps://github.com/harlanhaskins/Punctual.swift

鏂囩珷鏉ヨ嚜锛?1swift


以上是关于Swift 鏃ユ湡澶勭悊绫诲簱 Punctual.swift的主要内容,如果未能解决你的问题,请参考以下文章

PHP鍐呯疆鐨勫瓧绗︿覆澶勭悊鍑芥暟

moment.js 鏃ユ湡杞崲宸ュ叿

js鏃ユ湡鏍煎紡鍖栵紝宸ュ叿绫讳腑

Mac灏忔妧宸э細鍘婚櫎绯荤粺鎴浘鍚嶇殑鏃ユ湡鍚庣紑

鑷劧璇█澶勭悊锛氭枃鏈澶勭悊銆佽瑷€妯″瀷銆丷NN

绁炵粡缃戠粶锛氭壒澶勭悊