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. From double to Date

From double to Date

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 Posts 4 Posters 1 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.
  • C Offline
    C Offline
    Christer Claesson
    wrote on last edited by
    #1

    Have a Double and want to convert it to a Date format, any suggestions how to do it? And yes, having a date as a double is pretty stupid :-), but converting from double to string or long is not problem anyhow. But in the GUI I'm using one of those fancy almanacs that requires the Date format.

    M D A 3 Replies Last reply
    0
    • C Christer Claesson

      Have a Double and want to convert it to a Date format, any suggestions how to do it? And yes, having a date as a double is pretty stupid :-), but converting from double to string or long is not problem anyhow. But in the GUI I'm using one of those fancy almanacs that requires the Date format.

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      If your Double is number of ticks which should be long type , see the constructor of DateTime structure. Mazy
      "One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji

      1 Reply Last reply
      0
      • C Christer Claesson

        Have a Double and want to convert it to a Date format, any suggestions how to do it? And yes, having a date as a double is pretty stupid :-), but converting from double to string or long is not problem anyhow. But in the GUI I'm using one of those fancy almanacs that requires the Date format.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Where did this Double come from? Another system? If so, then you might have to do some tweaking because not all systems/languages use the same epoch as a starting point, or use the same units of measure. Some count the milliseconds from a specific date and time, others count the number of ticks from a date/time... With that in mind, you can use

        DateTime myDateTime(ticks

        where ticks is the number of 100-nanosecond intervals since 12:00am on Jan 1, 0001. Yes you read that right, the year 1. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        1 Reply Last reply
        0
        • C Christer Claesson

          Have a Double and want to convert it to a Date format, any suggestions how to do it? And yes, having a date as a double is pretty stupid :-), but converting from double to string or long is not problem anyhow. But in the GUI I'm using one of those fancy almanacs that requires the Date format.

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

          Search "zedgraph" in codeproject search. there are a class to solve it!

          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