Show standard time and date string : time « Data Types « C++ Tutorial

Home
C++ Tutorial
1.Language Basics
2.Data Types
3.Operators statements
4.Array
5.Development
6.Exceptions
7.Function
8.Structure
9.Class
10.Operator Overloading
11.Pointer
12.File Stream
13.template
14.STL Introduction
15.string
16.vector
17.list
18.bitset
19.set multiset
20.valarray
21.queue stack
22.deque
23.map multimap
24.STL Algorithms Modifying sequence operations
25.STL Algorithms Non modifying sequence operations
26.STL Algorithms Binary search
27.STL Algorithms Sorting
28.STL Algorithms Merge
29.STL Algorithms Min Max
30.STL Algorithms Iterator
31.STL Algorithms Heap
32.STL Algorithms Helper
C / ANSI-C
C Tutorial
C++
Visual C++ .NET
C++ Tutorial » Data Types » time 
2.33.2.Show standard time and date string
#include <iostream>
#include <ctime>

using namespace std;

int main() {
  char str[64];

  // Get the current system time.
  time_t t = time(NULL);

  // Show standard time and date string.
  strftime(str, 64"%c", localtime(&t));
  cout << "Standard format: " << str << endl;

  return 0;
}
2.33.time
2.33.1.Displays the current date and time
2.33.2.Show standard time and date string
2.33.3.Show a custom time and date string
2.33.4.%c specifies the standard time and date pattern
2.33.5.The strftime( ) Format Specifiers
2.33.6.Convert now to tm struct for UTC
2.33.7.Set the locale to US and get the time_put facet for US
2.33.8.Set the locale to Germany, Show standard time and date string
2.33.9.custom pattern displays hours and minutes followed by the date
2.33.10.Set the locale to Germany and get the time_put facet for Germany
2.33.11.Demonstrating the use of the localtime( ) and asctime( ) functions.
2.33.12.Demonstrating the use of the gmtime( ) and asctime( ) functions.
2.33.13.use of the strftime( ) function.
2.33.14.Demonstrating the use of the ctime( ) function.
2.33.15.Convert now to tm struct for local timezone
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.