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

x
?
Solved

Date and time

Posted on 2002-03-07
3
Medium Priority
?
236 Views
Last Modified: 2013-11-20
Hi,

I want to know how to get the system time like year, date and time, i am using Microsoft VC 6, plz help.

Thx
0
Comment
Question by:PX
[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
  • 2
3 Comments
 

Accepted Solution

by:
ndgun earned 60 total points
ID: 6848269
You can try the following windows base functions:
GetLocalTime()
GetSystemTime()

You can also try:
CTime::GetCurrentTime()
0
 
LVL 1

Author Comment

by:PX
ID: 6850061
hi ndgun,

Can u give me a smaple code snipet, thx a lot.
0
 

Expert Comment

by:ndgun
ID: 6850982
// example for CTime::GetCurrentTime
CTime t = CTime::GetCurrentTime();

You can look at MSDN for details on CTime class.


If you use the GetSystemTime, you can say
SYSTEMTIME SystemTime;
GetSystemTime(&SystemTime);

Again, MSDN on CD or microsoft website has details of the struct SYSTEMTIME.

typedef struct _SYSTEMTIME {  // st
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME;
 
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

670 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