Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. God dam dates

God dam dates

Scheduled Pinned Locked Moved ASP.NET
databasehelpsysadminquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sam Heller
    wrote on last edited by
    #1

    Good day my friends. I am having a few issues with dates. It's like this. Textbox auto populates on page load with todays date in english format (day/month/year). Then when I go to use this and stuff it in the database I get an error, pretty much cos the date is in the wrong format. So I added in the code to alter this to the correct (American) format for the db. This worked fine until code was passed over to my web server and then it stopped being happy about the format of the date from the text box. How do I get around this issue without getting to complex. Code is as follows Dim ExpiryDate As String = Convert.ToDateTime(ExpiryDateTB.Text.Trim()).ToString("MM/dd/yyyy")

    T N 2 Replies Last reply
    0
    • S Sam Heller

      Good day my friends. I am having a few issues with dates. It's like this. Textbox auto populates on page load with todays date in english format (day/month/year). Then when I go to use this and stuff it in the database I get an error, pretty much cos the date is in the wrong format. So I added in the code to alter this to the correct (American) format for the db. This worked fine until code was passed over to my web server and then it stopped being happy about the format of the date from the text box. How do I get around this issue without getting to complex. Code is as follows Dim ExpiryDate As String = Convert.ToDateTime(ExpiryDateTB.Text.Trim()).ToString("MM/dd/yyyy")

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      When updating the database do as follows I'm a C# guy but here is close to what you should do. Dim datetime d; if datetiem.tryparse(this.ExpiryDateTB.Text, out d) = true sqlparameter prm = new sqlparameter("@yourParam", d) do updates.

      I didn't get any requirements for the signature

      1 Reply Last reply
      0
      • S Sam Heller

        Good day my friends. I am having a few issues with dates. It's like this. Textbox auto populates on page load with todays date in english format (day/month/year). Then when I go to use this and stuff it in the database I get an error, pretty much cos the date is in the wrong format. So I added in the code to alter this to the correct (American) format for the db. This worked fine until code was passed over to my web server and then it stopped being happy about the format of the date from the text box. How do I get around this issue without getting to complex. Code is as follows Dim ExpiryDate As String = Convert.ToDateTime(ExpiryDateTB.Text.Trim()).ToString("MM/dd/yyyy")

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Use a UTC format to store your datetime. That way you eliminate the differences in culture. Also, I think you could choose a more appropriate subject than, God dam dates!! It's offensive and does not follow the guidelines. See How to get answers post at the top.


        only two letters away from being an asset

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups