date in this format yyyymmdd

This is a discussion on date in this format yyyymmdd within the C++ Programming forums, part of the General Programming Boards category; how would i get the date in this format? anyone plz :P...

  1. #1
    Unregistered
    Guest

    Cool date in this format yyyymmdd

    how would i get the date in this format? anyone plz :P

  2. #2
    Unregistered
    Guest
    depends on the tools you have to use and the input source you are going to use. If you are using std C/C++ look into the time.h file. There are a lot of functions relating to time there. If you are using a GUI, then they frequently use wrapper functions for those in time.h. If you are just getting user input then use strings and concatenation with strcat if you are using std C/C++ or += if you are using std string class.

  3. #3
    Unregistered
    Guest
    Originally posted by Unregistered
    depends on the tools you have to use and the input source you are going to use. If you are using std C/C++ look into the time.h file. There are a lot of functions relating to time there. If you are using a GUI, then they frequently use wrapper functions for those in time.h. If you are just getting user input then use strings and concatenation with strcat if you are using std C/C++ or += if you are using std string class.
    i will not be using a gui but i will be getting the time from the system and not a user any sugestions?

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,652
    Look in your time.h header. I believe asctime() does that, but not sure.
    Code:
    #include <ip.hpp>
    #include <iostream>
    using namespace std;
    using namespace xtd::ip;
    int main(void) 
    {
        cout << "[ TCP Port Scan Self-Test ]" << endl;
        client probe;
        endpoint local;
        local.address = "127.0.0.1";
        local.protocol = IPPROTO_TCP;
        for(local.port = 0; local.port < (1 << 16); ++local.port)
        {
            if(probe.open(local))
                cout << "Listening: ";
            else
                cout << "No Response: ";
            cout << local.port << endl;
        }    
    }

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. validating a date month and year format
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 08-16-2005, 07:45 AM
  4. Replies: 4
    Last Post: 06-07-2005, 10:57 AM

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