Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8279365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:18:51+00:00 2026-06-08T09:18:51+00:00

I have a C++/CX app that is processing some data from a file. It

  • 0

I have a C++/CX app that is processing some data from a file. It has a string in there representing the culture that was used to save the dates, and it has some dates. I need to convert them from strings to Platform::DateTime. I have heard that Windows::Globalization::DateTimeFormatting is the class to use, but I don’t see how to use it for that. Does anyone have an example?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T09:18:55+00:00Added an answer on June 8, 2026 at 9:18 am

    The C++/CX projection of WinRT differs from the Managed (C#/VB) projection in a number of ways, and one of the most major is in the projection of fundamental types (such as Point, Size, String, and DateTime).

    The managed projection projects these types as .NET types (with all the underlying support of the BCL) while the C++ projection generally minimally projects these types for interop, expecting the user to rely on C++ library support for more advanced functionality.

    So, where in .NET a signed 32-bit integer becomes a System.Int32 (with its relevant .Parse functionality) in C++ you get a regular C++ int and are expected to use CRT functionality (_wtoi) to accomplish a similar task. This difference often results in a ‘feature gap’ between the different projections, one of the more painful of which is in dealing with the DateTime structure (which has very rich support in the BCL).

    The solution I’ve managed to get was to start with the COleDateTime class (found by including ATLComTime.h) and going COleDateTime->SYSTEMTIME->FILETIME->_ULARGE_INTEGER->Windows::Foundation::DateTime. It’s serious gymnastics, but the COleDateTime class has the language-specific parsing capability that you require.

    LCID lcid = LocaleNameToLCID(L"es-es", LOCALE_ALLOW_NEUTRAL_NAMES); //parse language tag to get locale ID
    
    COleDateTime dt;
    dt.ParseDateTime(L"12 enero, 2012 10:00:01", 0, lcid); //parse date string based on language
    
    //get system time struct
    SYSTEMTIME st;
    dt.GetAsSystemTime(st);
    
    //COleDateTime is in local timezone, DateTime is in UTC, so we need to convert
    SYSTEMTIME st_utc;
    TzSpecificLocalTimeToSystemTime(nullptr, &st, &st_utc);
    
    //get filetime struct to get a time format compatible with DateTime
    FILETIME ft;
    SystemTimeToFileTime(&st_utc, &ft);
    
    //use _ULARGE_INTEGER to get a uint64 to set the DateTime struct to
    _ULARGE_INTEGER ulint = {ft.dwLowDateTime, ft.dwHighDateTime};
    
    Windows::Foundation::DateTime wfdt;
    wfdt.UniversalTime = ulint.QuadPart;
    

    I’ve asked around about the DateTimeFormatter class, and the documentation is incorrect; it does not support parsing and is not intended to (only formatting).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data to export from DB and save as CSV file, and
I have a rails app that has asynchronous processing, and I'm having trouble getting
I have an app that received JSON data from the server. Currently when I
I have some processing in my Cocoa app that sometimes ends up calling through
I have an app in android in which I return some data from facebook
Have an app that has listings - think classified ads - and each listing
I have an App that downloads and displays images from URL's. This works fine
I need to extract data from a DB2 table, run some processing on each
I have a database-synchronisation task that takes some time to process, as there are
have an app that finds your GPS location successfully, but I need to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.