CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    22

    How to get PC Cuurent Time by using C

    I understand that I can use the GetCurrentTime class for getting Current time from PC in C++. I just wonder how to write code for getting current time from PC by using C.

    Thank you for any help.


  2. #2
    Guest

    Re: How to get PC Cuurent Time by using C

    localtime()


  3. #3
    Join Date
    Jul 1999
    Location
    Pasadena, CA - USA
    Posts
    351

    Re: How to get PC Cuurent Time by using C


    Example

    /* STRTIME.C */

    #include <time.h>
    #include <stdio.h>

    void main( void )
    {
    char dbuffer [9];
    char tbuffer [9];
    _strdate( dbuffer );
    printf( "The current date is %s \n", dbuffer );
    _strtime( tbuffer );
    printf( "The current time is %s \n", tbuffer );
    }


    Output

    The current date is 03/23/93
    The current time is 13:40:40






    Regards,

    Paul Belikian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured