It's possible?
I have one wxDatePickerCtrl and i know GetValue() returning wxDateTime.
I need like something :
SetValue() = GetValue() - 1day;
SetValue() = GetValue() - 1month;
SetValue() = GetValue() - 1year;
Maybe is simple for this or must parse date and create value...
If possible this pls example how.
Thx
wxDatePickerCtrl and arithmetic operations Topic is solved
Re: wxDatePickerCtrl and arithmetic operations
Please check the documentation of both wxDatePickerCtrl and wxDateTime (in particular the Date Arithmetics section), it will become obvious what you can and cannot do.
But even without checking the API, it is pretty clear you cannot do something like this
as SetValue() method of wxWidgets controls always takes a value and returns void.
And you can do things like this
But even without checking the API, it is pretty clear you cannot do something like this
Code: Select all
SetValue() = GetValue() ...
And you can do things like this
Code: Select all
wxDateTime dt = wxDateTime::Now();
dt.Subtract(wxDateSpan(0,1)); // subtract a month
Re: wxDatePickerCtrl and arithmetic operations
Thanks for the useful info.
This code is what I need for -1 month
This code is what I need for -1 month
Code: Select all
wxDateTime dt = wxDateTime::Now();
dt.Subtract(wxDateSpan(0,1));
dpOd->SetValue(dt);
wxString do_date = dpOd->GetValue()).Format("%Y-%m-%d");