is there a way of seperating the date and time in vb6?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaz215
    New Member
    • Nov 2007
    • 55

    is there a way of seperating the date and time in vb6?

    hi! i just want to seperate the date and time from a date variable is there a way to do this? what i thought of is trimming but i dont know if that would really work
    i want to have a date datatype then place the date part on a txtdate.text then the time part on a txttime.text
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Are you retriving date from database ?

    Comment

    • jaz215
      New Member
      • Nov 2007
      • 55

      #3
      Originally posted by debasisdas
      Are you retriving date from database ?
      yup but in the database i just placed it as text..
      in Visual web developer i've done like getting the month, day, year from a date in the database but i dont know how to do in vb6 <note: i'm using access if this helps>

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Why don't you do all that formatting at database level itself.

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Hi,

          If you are saving Valid date and Time, then you can Seperate them using Format Function. something like this :

          [code=vb]
          If IsDate(RST("MyD TField")) Then
          txtDate = Format(RST("MyD TField"),"dd-mm-yyyy")
          txtTime = Format(RST("MyD TField"),"hh:mm :ss")
          End If
          [/code]

          Regards
          Veena

          Comment

          • jaz215
            New Member
            • Nov 2007
            • 55

            #6
            Originally posted by QVeen72
            Hi,

            If you are saving Valid date and Time, then you can Seperate them using Format Function. something like this :

            [code=vb]
            If IsDate(RST("MyD TField")) Then
            txtDate = Format(RST("MyD TField"),"dd-mm-yyyy")
            txtTime = Format(RST("MyD TField"),"hh:mm :ss")
            End If
            [/code]

            Regards
            Veena
            Got It! Thanks Veena!

            Comment

            Working...