- Metatrader's datetime is a Unix time stamp (seconds since 1970)
- C#'s datatime is a structure.
DateTime Struct (System) | Microsoft Docs
.net - What does "DateTime?" mean in C#? - Stack Overflow - They are not the same.
William Roeder:
Okey, I will try to convert them then :)
- Metatrader's datetime is a Unix time stamp (seconds since 1970)
- C#'s datatime is a structure.
DateTime Struct (System) | Microsoft Docs
.net - What does "DateTime?" mean in C#? - Stack Overflow - They are not the same.
This works :)
[DllExport("TestDate", CallingConvention = CallingConvention.StdCall)] [return: MarshalAs(UnmanagedType.LPWStr)] public static string TestDate(long Timestamp) { System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); dtDateTime = dtDateTime.AddSeconds(Timestamp); return "C# " + dtDateTime.ToString(); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Almost at the end of getting all the basics working when using DLL.
But I have the last issue with passing datetime.
MQL alert results when printing DLL return and simply MQL. C# should print the same date as native MQL, but it doesn't.
C#
MQL
/Hendrik