請問如何取得今年的1月1號時間格式?

 

假設今天是2019.08.01,請問我如何取得2019.01.01

假設今天是2018.03.05,請問我如何取得2018.01.01

感謝大家幫助,謝謝!~

 

参考

struct MqlDateTime 
  { 
   int year;           // Year 
   int mon;            // Month 
   int day;            // Day 
   int hour;           // Hour 
   int min;            // Minutes 
   int sec;            // Seconds 
   int day_of_week;    // Day of week (0-Sunday, 1-Monday, ... ,6-Saturday) 
   int day_of_year;    // Day number of the year (January 1st is assigned the number value of zero) 
  };

https://www.mql5.com/en/docs/constants/structures/mqldatetime

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Date Type Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Date Type Structure
  • www.mql5.com
Constants, Enumerations and Structures / Data Structures / Date Type Structure - Reference on algorithmic/automated trading language for MetaTrader 5
 
了解,謝謝!~
原因: