minuteOf() : Extract Minute from DateTime
On this page
Summary
Extract the minute component from a datetime value as a number (0-59).
Signature
minuteOf(datetime)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
datetime |
DateTime | Yes | The datetime to extract the minute from |
Returns
Type: Number (Integer)
The minute as a number from 0 to 59.
Examples
Display Minute
Data:
doc.Params["model"] = new {
time = new DateTime(2024, 3, 15, 14, 30, 0)
};
Output:
<p>Minute: 30</p>
Custom Time Format
Data:
doc.Params["model"] = new {
time = new DateTime(2024, 3, 15, 9, 5, 0)
};
Output:
<p>Time: 9:05</p>
Appointment Slot Detection
Data:
doc.Params["model"] = new {
appointmentTime = new DateTime(2024, 3, 15, 14, 30, 0)
};
Output:
<p>Time Slot: Half past</p>
Parking Time Calculation
Data:
doc.Params["model"] = new {
entry = new DateTime(2024, 3, 15, 10, 15, 0),
exit = new DateTime(2024, 3, 15, 12, 45, 0)
};
Output:
<h3>Parking Duration</h3>
<p>Hours: 2</p>
<p>Additional minutes: 30</p>
Meeting Start Validation
Data:
doc.Params["model"] = new {
meetings = new[] {
new { startTime = new DateTime(2024, 3, 15, 9, 0, 0) },
new { startTime = new DateTime(2024, 3, 15, 10, 15, 0) },
new { startTime = new DateTime(2024, 3, 15, 11, 30, 0) }
}
};
Output:
<p>9:00 AM</p>
<p>10:15 AM (Non-standard start time)</p>
<p>11:30 AM</p>
Notes
- Returns 0-59
- Date and hour components are ignored
- For full time formatting, use
format()function - Useful for:
- Custom time display
- Time slot validation
- Duration calculations
- Schedule adherence checking
- Combine with
hourOf()for complete time parsing - Use
padLeft()for zero-padded display (e.g., “05” instead of “5”)