Thread: Formatting problem with dates.

  1. #1

    Smile Formatting problem with dates.

    Got a program were user enters month, day, and year(19XX).

    Suppose to display 01/01/01 format with zeros in front of the single digit days and months; and years that have zero as 3rd digit (2001, 1909).

    Only display it as 1/1/1 right now.

    Thanks for any input.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    something along these lines should do it....

    cout<< ((Day<10) ? "0":"") << Day;

    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

  3. #3

    Smile It worked. Thanks so much..........

    and I learned something.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  2. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  3. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  4. problem formatting
    By PJYelton in forum C++ Programming
    Replies: 5
    Last Post: 11-07-2002, 09:06 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM