Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert string to systemtime (date) !

Posted on 1999-07-16
4
Medium Priority
?
3,314 Views
Last Modified: 2008-03-17
char szBufSTART[22]; // Is '1999-07-16-10.30.00'
I want to convert this string to SYSTEMTIME (or date, but then have to know how I convert SYSTEMTIME to date). How do I do that?
0
Comment
Question by:bert1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:bert1
ID: 1200367
Im using Borland C++ 5.02. (windows not dos dates please)
0
 
LVL 9

Accepted Solution

by:
jasonclarke earned 80 total points
ID: 1200368
You can use something like this (the day of week is not set though):

      SYSTEMTIME stime;
      char szBufSTART[] = "1999-07-16-10.30.00";

      sscanf(szBufSTART,"%d-%d-%d-%d.%d.%d",
               &stime.wYear,
               &stime.wMonth,
               &stime.wDay,
               &stime.wHour,
               &stime.wMinute,
               &stime.wSecond);

0
 

Author Comment

by:bert1
ID: 1200369
And then sTime = szBufSTART; ??
0
 

Author Comment

by:bert1
ID: 1200370
Sorry I was to fast forget:

"And then sTime = szBufSTART; ??"

Thanks! :-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question