// compute the week day from day/month/year: we use the dumbest algorithm
// possible: just compute our JDN and then use the (simple to derive)
// formula: weekday = (JDN + 1.5) % 7
- wday = (wxDateTime::wxDateTime_t)((wxDateTime::WeekDay)(GetTruncatedJDN(mday, mon, year) + 2) % 7);
+ wday = (wxDateTime::wxDateTime_t)((GetTruncatedJDN(mday, mon, year) + 2) % 7);
}
void wxDateTime::Tm::AddMonths(int monDiff)
return *this;
}
+wxDateTime wxDateTime::GetDateOnly() const
+{
+ Tm tm = GetTm();
+ tm.msec =
+ tm.sec =
+ tm.min =
+ tm.hour = 0;
+ return wxDateTime(tm);
+}
+
// ----------------------------------------------------------------------------
// DOS Date and Time Format functions
// ----------------------------------------------------------------------------
{
wxCHECK_MSG( format, wxEmptyString, _T("NULL format in wxDateTime::Format") );
- time_t time = GetTicks();
-
// we have to use our own implementation if the date is out of range of
// strftime() or if we use non standard specificators
#ifdef HAVE_STRFTIME
+ time_t time = GetTicks();
+
if ( (time != (time_t)-1) && !wxStrstr(format, _T("%l")) )
{
// use strftime()
// replace all occurrences of year with it
bool wasReplaced = fmt2.Replace(strYear, replacement) > 0;
// evaluation order ensures we always attempt the replacement.
- wasReplaced = (fmt2.Replace(strYear2, replacement2) > 0) | wasReplaced ;
+ wasReplaced = (fmt2.Replace(strYear2, replacement2) > 0) || wasReplaced;
// use strftime() to format the same date but in supported
// year