472,988 Members | 3,218 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 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 1394
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: thehaas | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm trying to use the datetime module. The following seems to work any day except the first day of the month: >>> import datetime >>> today =...
2
by: bncarper | last post by:
Relatively new to python. I can get the following to work from the command line: Python 2.3.4 (#2, Aug 18 2004, 21:49:15) on linux2 Type "help", "copyright", "credits" or "license" for more...
13
by: bredal Jensen | last post by:
Hello gurus, I'm building a small booking system and i have come accross quiet a tedious pitfall. "I need to make sure that people do not book for tomorrow when todays time is greater or...
6
by: Ante Perkovic | last post by:
Hi, How to declare datetime object and set it to my birthday, first or last day of this month or any other date. I can't find any examples in VS.NET help! BTW, what is the difference...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
4
by: Mohan | last post by:
In the database, we are storing time in 3 columns: hours, Minutes and AM,PM. After retrieving it from the database, I want to load these values into a DateTime variable. I haven't had much...
3
by: insyte | last post by:
With assistance from Gabriel and Frederik (and a few old threads in c.l.p.) I've been making headway on my specialized datetime class. Now I'm puzzled by behavior I didn't expect while attempting...
6
by: Jake K | last post by:
string var = DateTime.Today.Month.ToString() + "-" + DateTime.Today.Day.ToString() + "-" + DateTime.Today.Year.ToString() + "-" + DateTime.Today.Hour.ToString() + "-" +...
1
by: cinsky | last post by:
Hi, I got confused when I learned the function datetime.today(). So far I learned, unless an instance is created, it is not possible to call the class method. For example: class Foo: def...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.