time and date functions in C?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nike111
    New Member
    • Jun 2009
    • 15

    time and date functions in C?

    Can anyone say how to get and set the time and date of our choice , i mean in our own format like dd/mm/yy and 24 hrs clock using the existing functions or user-defined functions??????
    thanks in advance
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    The relevant Standard Library functions are declared in time.h. The C Standard Library does not include any functions for setting the time. You will need to use a platform-specific function for that.

    Standard functions localtime and time can be used together obtain the current tm time. Standard function strftime can be used to convert a tm time into a string of whatever format you desire.

    The sticky post at the front of the forum has links to Standard Library references. You would have had your answer an hour ago if you had looked there first.

    Comment

    Working...