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. ,how to show 24 hours time format ?

,how to show 24 hours time format ?

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-nettutorialquestion
4 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.
  • A Offline
    A Offline
    absprogrammer
    wrote on last edited by
    #1

    hi I'm using SQL server7.0 and asp.net. i'm store use datatype 'datetime' to store date in database. when i retrve data from database i want to show time in 24 hour format insted of 'am/pm' eg. '1:02:00 pm' ====> '13:00:00' thanks in advance.

    G M 2 Replies Last reply
    0
    • A absprogrammer

      hi I'm using SQL server7.0 and asp.net. i'm store use datatype 'datetime' to store date in database. when i retrve data from database i want to show time in 24 hour format insted of 'am/pm' eg. '1:02:00 pm' ====> '13:00:00' thanks in advance.

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

      Provide the correct CultureInfo when you convert the date to a string. Example: string myString = myDateTime.ToString("T", new CultureInfo(sv-SE")); --- b { font-weight: normal; }

      1 Reply Last reply
      0
      • A absprogrammer

        hi I'm using SQL server7.0 and asp.net. i'm store use datatype 'datetime' to store date in database. when i retrve data from database i want to show time in 24 hour format insted of 'am/pm' eg. '1:02:00 pm' ====> '13:00:00' thanks in advance.

        M Offline
        M Offline
        MihirV
        wrote on last edited by
        #3

        hi there, you can convert the database DateTime type to string in your front-end code like follows string sDate = dbDate.ToString( "dd/MM/yyyy HH:mm" ); will returns time in 24 hours format :) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..

        A 1 Reply Last reply
        0
        • M MihirV

          hi there, you can convert the database DateTime type to string in your front-end code like follows string sDate = dbDate.ToString( "dd/MM/yyyy HH:mm" ); will returns time in 24 hours format :) Confidence comes not from always being right, but from not fearing to be wrong..... Mihir..

          A Offline
          A Offline
          absprogrammer
          wrote on last edited by
          #4

          thanx

          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