Solved

Date and time

Posted on 2002-03-07
3
185 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
  • 2
3 Comments
 

Accepted Solution

by:
ndgun earned 20 total points
Comment Utility
You can try the following windows base functions:
GetLocalTime()
GetSystemTime()

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

Author Comment

by:PX
Comment Utility
hi ndgun,

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

Expert Comment

by:ndgun
Comment Utility
// 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now