Std::chrono year_month_day undefined

Hi, I am new to CUDA. I just created a new CUDA 12.6 Runtime project and compiled. It ran smoothly.
Then I added:

  1. include
    using namespace std::chrono;

  2. int main()

{
      time_point<system_clock> startTime = system_clock::now();
      year y{ 1981 };
      month m{ 3 };
     day d{ 1 };
     year_month_day date(y, m, d);
      .................
 }
  1. I also set the Project Properties C++ to ISO C++ 20 standard.

When I try to compile, this is the error:
identifier “day” is undefined
identifier “month” is undefined
identifier “year” is undefined
identifier “year_month_day” is undefined

My environment is:
Windows 11 Pro
Visual Studio 17.10.5
CUDA 12.6

What have I missed out?

Thank you.

when posting code on these forums, please format it properly. One approach to do that is:

  • edit your post above by clicking the pencil icon underneath it.
  • select the code in the edit pane
  • click the </> button at the top of the edit pane
  • save your changes

Please do that now.

I don’t have any trouble compiling that code on linux when I pass the compilation switch -std=c++20.

On windows I would probably investigate some approach like this.

Thank you. It worked.