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. Database & SysAdmin
  3. Database
  4. how to convert char to time

how to convert char to time

Scheduled Pinned Locked Moved Database
comtoolshelptutorialquestion
2 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.
  • S Offline
    S Offline
    Sachin Pimpale
    wrote on last edited by
    #1

    Hi all i want to convert char data to datetime but it dosent give me reqd output select convert(char(8),fieldname,108) as myTime from TableName fieldname datatype is char(8) it contain values like 1004,1200,1354 required outpot as 10:04,12:00,13:54 i used above expression but it doesn`t convert data in hh:mm:ss plz help

    The Stifler -- Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.

    H 1 Reply Last reply
    0
    • S Sachin Pimpale

      Hi all i want to convert char data to datetime but it dosent give me reqd output select convert(char(8),fieldname,108) as myTime from TableName fieldname datatype is char(8) it contain values like 1004,1200,1354 required outpot as 10:04,12:00,13:54 i used above expression but it doesn`t convert data in hh:mm:ss plz help

      The Stifler -- Bugs can neither be created nor be removed from software by a developer. They can only be converted from one form to another. The total number of bugs in the software always remain constant.

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      This will show the result in the required format, but it does not convert it to datetime: Select substring(fieldname,1,2) +':'+ substring(fieldname,3,2)

      Hesham A. Amin My blog

      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