MQL datetime to C# DLL
- 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(); }
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