Results 1 to 3 of 3

Thread: Removing ":" and space sign

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    66

    Removing ":" and space sign

    Hi,

    I have this code

    VB Code:
    1. Dim timenow as String = System.DateTime.now

    this return somethign like this

    Code:
    8-12-2004 22:18:05
    How do i remove those "-", ":" and the space between 2004 and 22?

    thanks

  2. #2
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871

    Re: Removing ":" and space sign

    You can get the date, year, month, time etc. all by themselves. Try this:
    System.DateTime.Now.Year, System.DateTime.Now.Month, System.DateTime.Now.Day etc.
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Removing ":" and space sign

    you can chain the replace function together (great little feature of the .net objects)

    Code:
            Dim str As String = Now.ToString
            str = str.Replace(":", "").Replace(" ", "").Replace("-", "")
            MsgBox(str)

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