473,378 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 1403
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.