Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time from epoch (1970)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time from epoch (1970)

    Hello ninjaz,

    i have a question..is there a way i could get the time from the starting of the epoch ( 1970 ) in miliseconds and in seconds?
    i couldn't figure this out...

    thanks in advance

    #2
    Qualitiedx,

    I am happy to assist you.

    What are you using this for? Could you please clarify?

    This would just be factoring in the number of years that elapsed, then accounting for months, days, hours, minutes, etc.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Epoch typically is the number of milliseconds (which should include leap seconds / milliseconds) starting from 1970; you can use any start time / date as a start reference point if you'd like.

      Basically, you can make use of .NET DateTime object.

      Code:
      private DateTime startOfEpoch = new DateTime(1970, 1, 1);
      The above can be used as a referenced

      Code:
      double cTime = (startOfEpoch).TotalMilliseconds;
      cTime in this case should have the current time in epoch.

      This is done from memory, but should get you started.

      good luck, and happy holidays!
      mrlogik
      NinjaTrader Ecosystem Vendor - Purelogik Trading

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, Yesterday, 04:31 AM
      0 responses
      31 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      286 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      283 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      133 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      91 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X