Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 algospoke, Yesterday, 06:40 PM
      2 responses
      19 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      44 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      180 views
      0 likes
      Last Post jeronymite  
      Working...
      X