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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. a stupid problem about DateTime

a stupid problem about DateTime

Scheduled Pinned Locked Moved C#
helpquestiondiscussion
3 Posts 2 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.
  • D Offline
    D Offline
    da vinci coder
    wrote on last edited by
    #1

    hi guys.. i've never faced with a problem like this, just want to ask u guys.. i declared a datetime component .. DateTime x = new DateTime(1900,01,01,7,0,0,0); everything is fine.. let`s write it to a textbox name tBox; tBox.Text = x.toLongTimeString(); everything is ok.. i get 7:00:00 but after i add some minute to this instance.. x.AddMinute(15); tBox.Text = x.toLongTimeString(); why the heck i get the 7:00:00 instead of getting 7:15:00 ?!?!?! any thoughts ? thanx good coding

    S 1 Reply Last reply
    0
    • D da vinci coder

      hi guys.. i've never faced with a problem like this, just want to ask u guys.. i declared a datetime component .. DateTime x = new DateTime(1900,01,01,7,0,0,0); everything is fine.. let`s write it to a textbox name tBox; tBox.Text = x.toLongTimeString(); everything is ok.. i get 7:00:00 but after i add some minute to this instance.. x.AddMinute(15); tBox.Text = x.toLongTimeString(); why the heck i get the 7:00:00 instead of getting 7:15:00 ?!?!?! any thoughts ? thanx good coding

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      You have to assign the return value of AddMinute to your variable x. x itself isn't changed.

      x = x.AddMinute(15);
      tBox.Text = x.toLongTimeString();


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      D 1 Reply Last reply
      0
      • S Stefan Troschuetz

        You have to assign the return value of AddMinute to your variable x. x itself isn't changed.

        x = x.AddMinute(15);
        tBox.Text = x.toLongTimeString();


        "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

        www.troschuetz.de

        D Offline
        D Offline
        da vinci coder
        wrote on last edited by
        #3

        thanx a lot.. good coding

        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