Thread: Getting time and date

  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

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 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.

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