You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/3.Manipulate_Date.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,8 @@
22
22
-[3.11 - Enumerate Dates for Weekday in Range](3.Manipulate_Date.md#enumerateweekdays)
23
23
-[3.12 - Random Dates](3.Manipulate_Date.md#randomdates)
24
24
-[3.13 - Sort Dates](3.Manipulate_Date.md#sort)
25
+
-[3.14 - Get the next weekday](3.Manipulate_Date.md#nextWeekDay)
26
+
-[3.15 - Get date at given week number/weekday](3.Manipulate_Date.md#dateAtWeeknumberWeekday)
25
27
26
28
Dates can be manipulated as you need by using classic math operators and readable time units.
27
29
@@ -479,4 +481,28 @@ let oldestDate = DateInRegion.oldestIn(list: arrayOfDates)
479
481
480
482
[^ Top](#index)
481
483
484
+
<aname="nextWeekDay"/>
485
+
486
+
## 3.14 - Get the next weekday
487
+
488
+
In order to get the next weekday preserving smaller components (hour, minute, seconds) you can use the `nextWeekday()` function:
489
+
490
+
```swift
491
+
let date1 =DateInRegion("2019-05-11 00:00:00", format: dateFormat, region: regionRome)!
492
+
let nextFriday = date1.nextWeekday(.friday) // 2019-05-17T00:00:00+02:00
493
+
```
494
+
495
+
[^ Top](#index)
496
+
497
+
<aname="dateAtWeeknumberWeekday"/>
498
+
499
+
## 3.15 - Get date at given week number/weekday
500
+
501
+
To returns the date at the given week number and week day preserving smaller components (hour, minute, seconds) you can use the `dateAt(weekdayOrdinal:weekday:monthNumber:yearNumber:)` function:
502
+
503
+
```swift
504
+
let date =DateInRegion("2019-05-11 00:00:00", format: dateFormat, region: regionRome)!
0 commit comments