Thread: current date

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    90

    current date

    i want today's date in day/month/year example 06-06-2007.
    month should in integer number
    how can i do this
    i tried "asctime" but in tht month is in string.
    thank u ,
    sree

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Look at the other functions in <time.h>.
    http://www.open-std.org/jtc1/sc22/wg...docs/n1124.pdf

    Notably, time and localtime.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Use strftime() for complete control over how each time component is shown.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    90
    thank u for ur reply can u show me any example .
    iam little bit confused onstrftime().
    thank u

  5. #5
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Similar to what's shown in 3.5.1, but different. Choose specifiers based on n1124.

    [edit]Oh, wait.[/edit]
    Last edited by Dave_Sinkula; 06-05-2007 at 11:36 PM. Reason: Probably to late to say, "Oh, wait."
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  6. #6
    Registered User
    Join Date
    Aug 2006
    Posts
    90
    thank u its' working finee

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Immediate programming help! Please!
    By xMEGANx in forum C++ Programming
    Replies: 6
    Last Post: 02-20-2008, 12:52 PM
  2. Problem with simple case statements
    By shoobsie in forum C Programming
    Replies: 2
    Last Post: 05-08-2006, 08:39 AM
  3. compiler build error
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2003, 10:16 AM
  4. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM
  5. How do I get the current date in my code?
    By FromHolland in forum C++ Programming
    Replies: 3
    Last Post: 04-08-2003, 01:37 PM