Selamat siang Sob, disini saya berbagi ilmu tentang membuat tanggal dan waktu dengan bahasa pemograman C++ #include #include using namespace std; int main( ) { // current date/time based on current system time_t now = time(0); cout << "Number of sec since January 1,1970:" << now << endl; tm *ltm = localtime(&now); // print various components of tm structure. cout << "Year: "<< 1900 + ltm->tm_year << endl; cout << "Month: "<< 1 + ltm->tm_mon<< endl; cout << "Day: "<< ltm->tm_mday << endl; cout << "Time: "<< 1 + ltm->tm_hour << ":"; cout << 1 + ltm->tm_min << ":"; cout << 1 + ltm->tm_sec << endl; } Kemudian akan tampil seperti ini Number of sec since January 1, 1970:1294548238 Year: 2011 Month: 1 Day: 8 Time: 22: 44:59
Berbagi pengalaman - pengalaman hidup melalui tulisan yang sekiranya bermanfaat bagi pembaca. Selamat Membaca