Results 1 to 8 of 8

Thread: Replace doesn't work

Threaded View

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Replace doesn't work

    this...
    Code:
    DateTime.Now.ToShortDateString().Replace("\\", "-")
    ...doesn't get rid of the "\" in the date string such as "02\12\03"

    it should be giving me "02-12-03".

    Whereas, this DOES work...
    Code:
    DateTime.Now.ToShortTimeString().Replace(":", ".")
    which gives me "10.15" rather than "10:15".

    What the hell is going on?

    this is my full code...
    Code:
    string pathTemp = itsLocalLogPath + category + "_" + DateTime.Now.ToShortDateString().Replace("\\", "-") + "_" + DateTime.Now.ToShortTimeString().Replace(":", ".") + EXTN_LOG_FILE;
    
    //write the error message to a local file on the HDD
    MySW = new StreamWriter(pathTemp, false);
    Last edited by wossname; Dec 2nd, 2003 at 11:00 AM.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width