Hi all,
here is the code
-----------------------------
char * date;
time_t timer;
timer = time(NULL);
date = asctime(localtime(&timer));
printf("Current Date: %s", date);
getchar();
return 0;
------------------------------
I'm trying to print a double number to generate a unique key
thank you
|
Go4Expert Member
|
|
| 5Jul2008,11:25 | #2 |
|
could not get you can you be a little bit more specific?
|
|
Light Poster
|
|
| 5Jul2008,22:30 | #3 |
|
Quote:
Originally Posted by dssr Fri July 04 2008 12:00 p.m. I want to print this instead: 07042008 or 070420081200 or convert the sting "Fri July 04 2008 12:00p.m." to double I tried atof() but gives me 0.000 thank you |
|
Go4Expert Member
|
|
| 5Jul2008,22:47 | #4 |
|
you can do that by using _strdate function
Code:
#include<stdio.h>
#include<time.h>
int main(void)
{
char datebuf[9];
_strdate(datebuf);
printf("Date : %s",datebuf);
return 0;
}
|
|
Go4Expert Member
|
|
| 5Jul2008,22:49 | #5 |
|
and i have posted an article on date and time management functions of C, please visit that, that may help you
|
|
Go4Expert Founder
|
![]() |
| 6Jul2008,10:12 | #6 |
|
Quote:
Originally Posted by dssr |
|
Light Poster
|
|
| 9Jul2008,04:14 | #7 |
|
Thank you so much guys ! I was using CVI which got its own time functions, but what you gave me helped.
|
|
Go4Expert Member
|
|
| 13Jul2008,19:18 | #8 |
|
Quote:
Originally Posted by Musab My pleasure
|

