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 claxxical, 05-30-2017, 12:30 PM
      37 responses
      4,452 views
      0 likes
      Last Post Padan
      by Padan
       
      Started by SugarDefwebsite, Today, 02:18 AM
      0 responses
      3 views
      0 likes
      Last Post SugarDefwebsite  
      Started by usglucofreeze, Today, 01:19 AM
      0 responses
      7 views
      0 likes
      Last Post usglucofreeze  
      Started by f.saeidi, Today, 01:12 AM
      0 responses
      10 views
      0 likes
      Last Post f.saeidi  
      Started by NinjaTrader_ChelseaB, 03-14-2017, 10:17 AM
      227 responses
      34,319 views
      7 likes
      Last Post rare312
      by rare312
       
      Working...
      X