Thread: Just Finding anything w/System Date

  1. #1
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question Just Finding anything w/System Date

    How do I find system date/time? I'm using visual c++ 6.0 and I haven't come across any function except for time.h(which I can't figure out).

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Code:
    #include <windows.h>
    #include <iostream>
    
    
    int main(void)
    {
    	SYSTEMTIME st;
    	GetSystemTime(&st);
    	const char* DayArray[] = {"Sunday","Monday","Tuesday","Wednesday",
    		"Thursday","Friday","Saturday"};
    
    	std::cout << "It is " << st.wHour << ":";
    	std::cout << st.wMinute << ":" << st.wSecond;
    	std::cout << " and the date is " << DayArray[st.wDayOfWeek];
    	std::cout << " " << st.wDay << "/" << st.wMonth << "/";
    	std::cout << st.wYear << std::endl;
    
    	return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 08:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. CDate Class - handle date manipulation simply
    By LuckY in forum C++ Programming
    Replies: 5
    Last Post: 07-16-2003, 08:35 AM
  4. Finding Seperate Parts of Date
    By drdroid in forum C++ Programming
    Replies: 1
    Last Post: 02-14-2003, 09:24 PM