mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Date
- Implemented Date::dayOfYear which yields a number, 1 to 366.
This commit is contained in:
parent
b4be5991b8
commit
27752bd510
3 changed files with 15 additions and 2 deletions
|
@ -100,7 +100,7 @@ Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */)
|
|||
|
||||
unsigned int i = 0; // Index into input.
|
||||
|
||||
// Format may include: mMdDyYVaAbBhHNS
|
||||
// Format may include: mMdDyYVaAbBhHNSjJ
|
||||
//
|
||||
// Note that the format should never include T or Z, as that interferes with
|
||||
// the potential parsing for ISO dates constructed from the above format.
|
||||
|
@ -666,6 +666,13 @@ int Date::dayOfWeek (const std::string& input)
|
|||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::dayOfYear () const
|
||||
{
|
||||
struct tm* t = localtime (&mT);
|
||||
return t->tm_yday + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::monthOfYear (const std::string& input)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue