Getter/Setter
Moment.apex has getters/setters for Date/Time fields like:
Moment m = new Moment();
m.hour(12); // set the hour
m.hours(12); // set the hour
m.hour(); // get the hour
m.hours(); // get the hourBelow is the table of the fields supporting these getters/setters.
| Field | Description |
|---|---|
| millisecond(s) | Get/set the millisecond |
| second(s) | Get/set the second |
| minute(s) | Get/set the minute |
| hour(s) | Get/set the hour |
| day(s) | Get/set the day |
| month(s) | Get/set the day |
| year(s) | Get/set the year |
| dayOfWeek | Get/set the day of week |
| dayOfYear | Get/set the day of year |
| week(s) | Get/set the week of year |
| quarter(s) | Get/set the quarter of year |
Besides, we have generic methods to access Date/Time fields.
Moment m = new Moment();
m.field('year'); // get the year
m.field('year', 2018); // set the year| Method | Description |
|---|---|
| field | Get/set the field |