mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601: Added ::toISOLocalExtended method
This commit is contained in:
parent
1cb295ef67
commit
61fc32d04f
2 changed files with 23 additions and 0 deletions
|
@ -1043,6 +1043,28 @@ std::string ISO8601d::toISO () const
|
|||
return iso.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 1998-01-19T07:00:00 = YYYY-MM-DDThh:mm:ss
|
||||
std::string ISO8601d::toISOLocalExtended () const
|
||||
{
|
||||
struct tm* t = localtime (&_date);
|
||||
|
||||
std::stringstream iso;
|
||||
iso << std::setw (4) << std::setfill ('0') << t->tm_year + 1900
|
||||
<< "-"
|
||||
<< std::setw (2) << std::setfill ('0') << t->tm_mon + 1
|
||||
<< "-"
|
||||
<< std::setw (2) << std::setfill ('0') << t->tm_mday
|
||||
<< "T"
|
||||
<< std::setw (2) << std::setfill ('0') << t->tm_hour
|
||||
<< ":"
|
||||
<< std::setw (2) << std::setfill ('0') << t->tm_min
|
||||
<< ":"
|
||||
<< std::setw (2) << std::setfill ('0') << t->tm_sec;
|
||||
|
||||
return iso.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
double ISO8601d::toJulian () const
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
time_t toEpoch () const;
|
||||
std::string toEpochString () const;
|
||||
std::string toISO () const;
|
||||
std::string toISOLocalExtended () const;
|
||||
double toJulian () const;
|
||||
void toMDY (int&, int&, int&) const;
|
||||
const std::string toString (const std::string& format = "m/d/Y") const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue