I have program here that defaults the current date as u can see, I want to have the default rather the TO date should the current date and from could be 1 week prior current date rather than this,
"1/1/0001
12:00:00 AM
Can
I code this here and how to do this?
code
here:
private
void
LoadData()
{
_context =
newADLPRO2Entities_Master();
DateTime?
df = null;
DateTime?
dt = null;
string
strUnit = null;
if
(dtFrom.Date.ToString() == "1/1/0001
12:00:00 AM")
{
df =
null;
}
else
{
df = dtFrom.Date;
}
if
(dtThru.Date.ToString() == "1/1/0001
12:00:00 AM")
TranceFrank
Member
102 Points
180 Posts
How to prefill better dates
Dec 05, 2012 07:30 PM|LINK
I have program here that defaults the current date as u can see, I want to have the default rather the TO date should the current date and from could be 1 week prior current date rather than this,
"1/1/0001 12:00:00 AM
Can I code this here and how to do this?
code here:
private
void LoadData()
{
_context =
new ADLPRO2Entities_Master();
DateTime? df = null;
DateTime? dt = null;
string strUnit = null;
if (dtFrom.Date.ToString() == "1/1/0001 12:00:00 AM")
{
df =
null;
}
else
{
df = dtFrom.Date;
}
if (dtThru.Date.ToString() == "1/1/0001 12:00:00 AM")
{
dt =
null;
Yanping Wang...
Star
14871 Points
1529 Posts
Microsoft
Re: How to prefill better dates
Dec 07, 2012 01:32 AM|LINK
Hi TranceFrank,
If you need a date 1 week prior from today in the specified format. you can refer
Dim regDate As Date = Date.Now() Dim newDate As Date = DateAdd(DateInterval.Day, -7, regDate) TextBox1.Text = newDate.ToString("dd/MM/yyyy")for more details about Custom Date and Time Format Strings please refer http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
thanks.
Feedback to us
Develop and promote your apps in Windows Store