Getting time and date

This is a discussion on Getting time and date within the C++ Programming forums, part of the General Programming Boards category; how can i get the time and the date from the pc and store it in variable ??? eg : ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    41

    Getting time and date

    how can i get the time and the date from the pc and store it in variable ???


    eg :

    i wan to assign the current time which is 4.15pm to timex variable and 19/08/2004 which is today's date to datex variable. How i can archieve this ?

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    41
    sfmttime( str, sizeof(str)-1,
    "1) It's %A, %B %d\n", &today );

    I tried using the following function to store the string into str but i got the following error msg

    Message.cpp: In method `TSMessage::TSMessage()':
    Message.cpp:94: implicit declaration of function `int sfmttime(...)'
    make: *** [Message.o] Error 1


    Why does this happend ??

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,498
    > Why does this happend ??
    Because you can't spell strftime properly
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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. How to get and set windows time and date
    By huwan in forum Windows Programming
    Replies: 18
    Last Post: 05-13-2008, 10:33 AM
  4. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 10:42 AM

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