471,330 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

setting my dateTime.Today

vs 2008 c#
How to set my computer's date to +7 days from today's date...?

TIA
Jun 27 '08 #1
4 1360
On May 21, 11:10 am, raulavi <raul...@discussions.microsoft.com>
wrote:
vs 2008 c#
How to set my computer's date to +7 days from today's date...?

TIA
you can run cmd.exe and execute date command using Process class.

Jun 27 '08 #2
how would you do it in c# ?

"parez" wrote:
On May 21, 11:10 am, raulavi <raul...@discussions.microsoft.com>
wrote:
vs 2008 c#
How to set my computer's date to +7 days from today's date...?

TIA

you can run cmd.exe and execute date command using Process class.

Jun 27 '08 #3
On May 21, 11:52 am, raulavi <raul...@discussions.microsoft.com>
wrote:
how would you do it in c# ?

"parez" wrote:
On May 21, 11:10 am, raulavi <raul...@discussions.microsoft.com>
wrote:
vs 2008 c#
How to set my computer's date to +7 days from today's date...?
TIA
you can run cmd.exe and execute date command using Process class.
the following worked for me..

ProcessStartInfo startInfo = new
ProcessStartInfo("cmd.exe");
startInfo.UseShellExecute = false;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;

Process process = Process.Start(startInfo);

string command = String.Format("date\r\n{0}\r\n",
DateTime.Now.AddDays(7).ToString("MM-dd-yy"));
StreamWriter commandWriter = process.StandardInput;
commandWriter.WriteLine(command);
commandWriter.Flush();
commandWriter.Close();
process.Close();
Jun 27 '08 #4
thank you...I will give it a try.

"parez" wrote:
On May 21, 11:52 am, raulavi <raul...@discussions.microsoft.com>
wrote:
how would you do it in c# ?

"parez" wrote:
On May 21, 11:10 am, raulavi <raul...@discussions.microsoft.com>
wrote:
vs 2008 c#
How to set my computer's date to +7 days from today's date...?
TIA
you can run cmd.exe and execute date command using Process class.

the following worked for me..

ProcessStartInfo startInfo = new
ProcessStartInfo("cmd.exe");
startInfo.UseShellExecute = false;
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;

Process process = Process.Start(startInfo);

string command = String.Format("date\r\n{0}\r\n",
DateTime.Now.AddDays(7).ToString("MM-dd-yy"));
StreamWriter commandWriter = process.StandardInput;
commandWriter.WriteLine(command);
commandWriter.Flush();
commandWriter.Close();
process.Close();
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by thehaas | last post: by
2 posts views Thread by bncarper | last post: by
13 posts views Thread by bredal Jensen | last post: by
6 posts views Thread by Ante Perkovic | last post: by
9 posts views Thread by Phil B | last post: by
4 posts views Thread by Mohan | last post: by
6 posts views Thread by Jake K | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.