Just Finding anything w/System Date

This is a discussion on Just Finding anything w/System Date within the C++ Programming forums, part of the General Programming Boards category; How do I find system date/time? I'm using visual c++ 6.0 and I haven't come across any function except for ...

  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,789
    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, 09:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  3. CDate Class - handle date manipulation simply
    By LuckY in forum C++ Programming
    Replies: 5
    Last Post: 07-16-2003, 09:35 AM
  4. Finding Seperate Parts of Date
    By drdroid in forum C++ Programming
    Replies: 1
    Last Post: 02-14-2003, 09:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21