setting my dateTime.Today

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cmF1bGF2aQ==?=

    setting my dateTime.Today

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

    TIA


  • parez

    #2
    Re: setting my dateTime.Today

    On May 21, 11:10 am, raulavi <raul...@discus sions.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.

    Comment

    • =?Utf-8?B?cmF1bGF2aQ==?=

      #3
      Re: setting my dateTime.Today

      how would you do it in c# ?

      "parez" wrote:
      On May 21, 11:10 am, raulavi <raul...@discus sions.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.
      >
      >

      Comment

      • parez

        #4
        Re: setting my dateTime.Today

        On May 21, 11:52 am, raulavi <raul...@discus sions.microsoft .com>
        wrote:
        how would you do it in c# ?
        >
        "parez" wrote:
        On May 21, 11:10 am, raulavi <raul...@discus sions.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..

        ProcessStartInf o startInfo = new
        ProcessStartInf o("cmd.exe");
        startInfo.UseSh ellExecute = false;
        startInfo.Redir ectStandardInpu t = true;
        startInfo.Redir ectStandardOutp ut = true;

        Process process = Process.Start(s tartInfo);

        string command = String.Format(" date\r\n{0}\r\n ",
        DateTime.Now.Ad dDays(7).ToStri ng("MM-dd-yy"));
        StreamWriter commandWriter = process.Standar dInput;
        commandWriter.W riteLine(comman d);
        commandWriter.F lush();
        commandWriter.C lose();
        process.Close() ;

        Comment

        • =?Utf-8?B?cmF1bGF2aQ==?=

          #5
          Re: setting my dateTime.Today

          thank you...I will give it a try.

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

          "parez" wrote:
          On May 21, 11:10 am, raulavi <raul...@discus sions.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..
          >
          ProcessStartInf o startInfo = new
          ProcessStartInf o("cmd.exe");
          startInfo.UseSh ellExecute = false;
          startInfo.Redir ectStandardInpu t = true;
          startInfo.Redir ectStandardOutp ut = true;
          >
          Process process = Process.Start(s tartInfo);
          >
          string command = String.Format(" date\r\n{0}\r\n ",
          DateTime.Now.Ad dDays(7).ToStri ng("MM-dd-yy"));
          StreamWriter commandWriter = process.Standar dInput;
          commandWriter.W riteLine(comman d);
          commandWriter.F lush();
          commandWriter.C lose();
          process.Close() ;
          >

          Comment

          Working...