Enhancement - New columns for custom reports
- Added 'entry_time', 'start_time' and 'end_time' columns that include the time as well as the date.
This commit is contained in:
34
src/Date.cpp
34
src/Date.cpp
@@ -271,6 +271,19 @@ const std::string Date::toString (const std::string& format /*= "m/d/Y" */) cons
|
||||
return formatted;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::string Date::toStringWithTime (const std::string& format /*= "m/d/Y" */) const
|
||||
{
|
||||
// Format as above.
|
||||
std::string formatted = toString (format);
|
||||
|
||||
char buffer[12];
|
||||
sprintf (buffer, " %d:%02d:%02d", hour (), minute (), second ());
|
||||
formatted += buffer;
|
||||
|
||||
return formatted;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::valid (const std::string& input, const std::string& format)
|
||||
{
|
||||
@@ -456,6 +469,27 @@ int Date::year () const
|
||||
return t->tm_year + 1900;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::hour () const
|
||||
{
|
||||
struct tm* t = localtime (&mT);
|
||||
return t->tm_hour;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::minute () const
|
||||
{
|
||||
struct tm* t = localtime (&mT);
|
||||
return t->tm_min;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int Date::second () const
|
||||
{
|
||||
struct tm* t = localtime (&mT);
|
||||
return t->tm_sec;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::operator== (const Date& rhs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user