From String to correct DateTime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • perikolo
    New Member
    • Aug 2009
    • 2

    From String to correct DateTime

    So, I'm trying to do this...
    DatumRodjenja_d b = DatumRodjenja.S ubstring(6, 4) & "-" & DatumRodjenja.S ubstring(3, 2) & "-" & DatumRodjenja.S ubstring(0, 2)

    Where DatumRodjenja_d b is DateTime variable, and DatumRodjenja is String. And even after that, I'm still getting DatumRodjenja_d b in this format "DD.MM.YYYY ."

    The thing is I need date in "YYYY-MM-DD" format because that's how I store it into database.

    I suppose this is some kind of problem in CultureInfo but still I can't figure it out...thank you.
  • kuldeepjat
    New Member
    • Aug 2009
    • 4

    #2
    you will format date in mm/dd/yyyy format and then enter

    Comment

    • perikolo
      New Member
      • Aug 2009
      • 2

      #3
      Originally posted by kuldeepjat
      you will format date in mm/dd/yyyy format and then enter
      Can you explain me how? Because everything I've tried a lot of stuff and didn't find the solution.
      thanks

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Use the DateTime's ToString method. Supply the ToString method with a "format string" that specifies how the string should be printed.

        Check this out. It gives you a listing of standard date/time format strings.

        -Frinny

        Comment

        • starlight849
          New Member
          • Jun 2009
          • 82

          #5
          cdate(yourdate) .tostring("yyyy/MM/dd")

          Comment

          Working...