remove date second part

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

    remove date second part

    Hi, All,

    I want to remove date second part or change second pard to 00 if second part
    is not 00. For example, change 2/13/2007 2:30:15 PM to 2/13/2007 2:30 PM , or
    change 2/13/2007 2:30:15 PM to 2/13/2007 2:30:00 PM, can anyone help this
    out?

    Thanks in advance,
    Martin
  • ClayB

    #2
    Re: remove date second part

    One way you could do this is:

    ' dt is your DateTime object with seconds

    dt = dt.AddSeconds(-dt.Second)

    ==============
    Clay Burch
    Syncfusion, Inc.

    Comment

    • Tiago Salgado

      #3
      Re: remove date second part

      You want something like this ?

      Dim data As Date = DateTime.Now
      Dim str As String = data.ToShortDat eString & " " & data.ToShortTim eString
      MessageBox.Show (str)

      --

      Tiago Salgado



      Website da comunidade Portugal-a-Programar, a comunidade portuguesa de programação. Fórum de discussão de temas relacionados com programação e informática em geral, Portal de Downloads, Blogs, Wiki e Revista Programar.

      Portal da Revista PROGRAMAR, a revista portuguesa de programação


      "martin1" <martin1@discus sions.microsoft .comwrote in message
      news:F26FC8F6-8344-4388-944F-EA8AD6B6C912@mi crosoft.com...
      Hi, All,
      >
      I want to remove date second part or change second pard to 00 if second
      part
      is not 00. For example, change 2/13/2007 2:30:15 PM to 2/13/2007 2:30 PM ,
      or
      change 2/13/2007 2:30:15 PM to 2/13/2007 2:30:00 PM, can anyone help this
      out?
      >
      Thanks in advance,
      Martin
      >

      Comment

      • =?Utf-8?B?bWFydGluMQ==?=

        #4
        Re: remove date second part

        Thank you. Clay

        "ClayB" wrote:
        One way you could do this is:
        >
        ' dt is your DateTime object with seconds
        >
        dt = dt.AddSeconds(-dt.Second)
        >
        ==============
        Clay Burch
        Syncfusion, Inc.
        >
        >

        Comment

        • =?Utf-8?B?bWFydGluMQ==?=

          #5
          Re: remove date second part

          Thnak you very much. Tiago

          Martin

          "Tiago Salgado" wrote:
          You want something like this ?
          >
          Dim data As Date = DateTime.Now
          Dim str As String = data.ToShortDat eString & " " & data.ToShortTim eString
          MessageBox.Show (str)
          >
          --
          >
          Tiago Salgado
          >


          Website da comunidade Portugal-a-Programar, a comunidade portuguesa de programação. Fórum de discussão de temas relacionados com programação e informática em geral, Portal de Downloads, Blogs, Wiki e Revista Programar.

          Portal da Revista PROGRAMAR, a revista portuguesa de programação

          >
          "martin1" <martin1@discus sions.microsoft .comwrote in message
          news:F26FC8F6-8344-4388-944F-EA8AD6B6C912@mi crosoft.com...
          Hi, All,

          I want to remove date second part or change second pard to 00 if second
          part
          is not 00. For example, change 2/13/2007 2:30:15 PM to 2/13/2007 2:30 PM ,
          or
          change 2/13/2007 2:30:15 PM to 2/13/2007 2:30:00 PM, can anyone help this
          out?

          Thanks in advance,
          Martin
          >

          Comment

          Working...