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 Stanfillirenfro, Today, 07:23 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      2 responses
      21 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by olisav57, Yesterday, 07:39 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      7 responses
      944 views
      0 likes
      Last Post Jquiroz1975  
      Started by oviejo, Today, 12:28 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X