- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeStamp.cpp
More file actions
Latest commit
executable file
·20 lines (16 loc) · 492 Bytes
/
Copy pathTimeStamp.cpp
File metadata and controls
executable file
·20 lines (16 loc) · 492 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
#include"time.h"
#include<stdio.h>
usingnamespacestd;
intmain(void){
time_t myTime;
time_t myTime2;
myTime = time(NULL);
//myTime = time(&myTime);
cout << myTime << endl; //1211768933
cout << asctime(localtime(&myTime)) << endl; //Mon May 26 10:28:53 2008
cout << localtime(&myTime) << endl; //00478E80
char * timeStamp = asctime(localtime(&myTime));
printf("mytime: %s\n", timeStamp); //mytime: Mon May 26 10:28:53 2008
return0;
}