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. datetime object problem

datetime object problem

Scheduled Pinned Locked Moved ASP.NET
helpquestion
8 Posts 4 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.
  • V Offline
    V Offline
    VijayVishwakarma
    wrote on last edited by
    #1

    Hi, I have an date time object in which I m storing date like 12/12/2008 06:00 AM Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM. Can any one help?? Regards

    Vijay V. Yash Softech

    B G A 3 Replies Last reply
    0
    • V VijayVishwakarma

      Hi, I have an date time object in which I m storing date like 12/12/2008 06:00 AM Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM. Can any one help?? Regards

      Vijay V. Yash Softech

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      string hour = DateTime.Now.ToString("HH:mm"); Hope this will help you.


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.

      1 Reply Last reply
      0
      • V VijayVishwakarma

        Hi, I have an date time object in which I m storing date like 12/12/2008 06:00 AM Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM. Can any one help?? Regards

        Vijay V. Yash Softech

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        VijayVishwakarma wrote:

        I have an date time object in which I m storing date like 12/12/2008 06:00 AM Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM.

        Then you probably don't manage to parse the string correctly into a DateTime Value. How do you parse the string?

        Despite everything, the person most likely to be fooling you next is yourself.

        V 1 Reply Last reply
        0
        • G Guffa

          VijayVishwakarma wrote:

          I have an date time object in which I m storing date like 12/12/2008 06:00 AM Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM.

          Then you probably don't manage to parse the string correctly into a DateTime Value. How do you parse the string?

          Despite everything, the person most likely to be fooling you next is yourself.

          V Offline
          V Offline
          VijayVishwakarma
          wrote on last edited by
          #4

          Its an datetime object returned from database.

          Vijay V. Yash Softech

          G 1 Reply Last reply
          0
          • V VijayVishwakarma

            Hi, I have an date time object in which I m storing date like 12/12/2008 06:00 AM Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM. Can any one help?? Regards

            Vijay V. Yash Softech

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            VijayVishwakarma wrote:

            Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM.

            Just Put your code over here !!!

            cheers, Abhijit

            V 1 Reply Last reply
            0
            • A Abhijit Jana

              VijayVishwakarma wrote:

              Now I m trying to get only the time part I mean 06:00 AM. each time I tried I m getting 12:00 AM.

              Just Put your code over here !!!

              cheers, Abhijit

              V Offline
              V Offline
              VijayVishwakarma
              wrote on last edited by
              #6

              Problem solved.Thanks

              Vijay V. Yash Softech

              1 Reply Last reply
              0
              • V VijayVishwakarma

                Its an datetime object returned from database.

                Vijay V. Yash Softech

                G Offline
                G Offline
                Guffa
                wrote on last edited by
                #7

                Ok. Do you store it as a datetime or a varcahr in the database? Do you convert the vale to a string when you get it from the database? Have you verified that the value is stored correctly in the database?

                Despite everything, the person most likely to be fooling you next is yourself.

                V 1 Reply Last reply
                0
                • G Guffa

                  Ok. Do you store it as a datetime or a varcahr in the database? Do you convert the vale to a string when you get it from the database? Have you verified that the value is stored correctly in the database?

                  Despite everything, the person most likely to be fooling you next is yourself.

                  V Offline
                  V Offline
                  VijayVishwakarma
                  wrote on last edited by
                  #8

                  Hi thanks I got this problem solved.

                  Vijay V. Yash Softech

                  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