| | |
A simple query
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
There functions in <time.h> such as time, localtime, and strftime.
C Syntax (Toggle Plain Text)
#include <stdio.h> #include <time.h> int main(void) { time_t now; if ( time(&now) != (time_t)(-1) ) { struct tm *mytime = localtime(&now); if ( mytime ) { char buffer [ 32 ]; if ( strftime(buffer, sizeof buffer, "%x", mytime) ) { printf("buffer = \"%s\"\n", buffer); } } } return 0; } /* my output buffer = "06/08/05" */
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Similar Threads
- simple query about cout (C)
- Newbie - looping and array [very simple] problem (PHP)
- Help with simple shell script (Windows NT / 2000 / XP)
- microsoft access simple date query (Computer Science)
- Please help me out with MySQL query (MySQL)
- DB-Authentication php/mysql on Mac OSX v3 (PHP)
Other Threads in the C Forum
- Previous Thread: StretchDIBits
- Next Thread: how to reverse link list using recurtion
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks binarysearch calculate centimeter char convert copyanyfile copyimagefile copypdffile cprogramme createcopyoffile csyntax directory drawing dynamic executable fflush file fork frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop initialization interest km lazy linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix power problem probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling scripting segmentationfault send shape socketprograming spoonfeeding stack standard string strings structures student suggestions systemcall test testautomation unix user variable voidmain() wab win32api windows.h






