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: README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ void main() {
88
88
89
89
Jalali and Gregorian objects are immutable. So using operators and methods will give you new object and does not manipulate the object in place, like String objects. Almost all other objects in shamsi_date library are immutable too.
90
90
91
-
You can access `year`, `month`, `day`, `hour`, `minute`, `second` and `millisecond` through getters on Jalali or Gregorian dates. You can get week day number of Jalali and Gregorian by using `weekDay` getter. Week days range from 1 to 7. Jalali week starts with `Shanbe` and Gregorian week starts with `Monday`. Month length can be accessed using `monthLength` getter. Month length is sensitive to leap years. you can check if the year is a leap year by `isLeapYear()` method. Julian day number is also accessible through `julianDayNumber` getter. for example:
91
+
You can access `year`, `month`, `day`, `hour`, `minute`, `second` and `millisecond` through getters on Jalali or Gregorian dates. You can get week day number of Jalali and Gregorian by using `weekDay` getter. Week days range from 1 to 7. Jalali week starts with `Shanbe` and Gregorian week starts with `Monday`. Month length can be accessed using `monthLength` getter. Month length is sensitive to leap years. you can check if the year is a leap year by `isLeapYear()` method. Julian day number is also accessible through `julianDayNumber` getter. You can get day of year using `dayOfYear` getter. for example:
92
92
93
93
```dart
94
94
Jalali j = Jalali(1397, 5, 6, 12, 56, 34, 585);
@@ -111,6 +111,8 @@ int ml = j.monthLength; // ml = 31
111
111
// note: month and day values are not important for isLeapYear() method
112
112
bool ly = j.isLeapYear(); // ly = false (1397 is not leap year)
113
113
114
+
int doy = j.dayOfYear;
115
+
114
116
// and equivalently for Gregorian date objects ...
115
117
```
116
118
@@ -323,7 +325,18 @@ Use toString() of Jalali and Georgian dates only for development purpose, like f
323
325
- mNAf: month name in **Afghanistan**. (**ONLY** for `JalaliFormatter`.)
324
326
- d: day (whatever length it has).
325
327
- dd: two digit day.
328
+
- doy: day of year.
329
+
- dddoy: three-digit day of year.
326
330
- wN: week day name.
331
+
- tH: hour.
332
+
- tHH: 2-digit hour.
333
+
- tM: minute.
334
+
- tMM: 2-digit minute.
335
+
- tS: seconds.
336
+
- tSS: two-digit seconds.
337
+
- tMS: milliseconds.
338
+
- tMSSS: three-digit milliseconds.
339
+
- ds: date seperator. `-` for Gregorian and `/` for Jalali.
327
340
328
341
You can get date formatter by using `formatter` getter on Jalali and Gregorian date objects. Simply cash this formatter in a Jalali value and then use string interpolation (as we have shown in examples) for making your desired output. This way of formatting is more powerful (and arguably easier) than using templates.
0 commit comments