Solved

Date and time

Posted on 2002-03-07
3
196 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 32
sameEnds challenge 3 136
Doc'in system (example?) BA 7 89
lucky13 challenge 11 125
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

23 Experts available now in Live!

Get 1:1 Help Now