mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-04 21:24:26 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -28,7 +28,7 @@ look if ported to this library.
|
||||
<a name="Dates_as_Strings"></a>
|
||||
### Dates as String
|
||||
```c++
|
||||
#include "date.h"
|
||||
#include "date/date.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -59,8 +59,9 @@ main()
|
||||
|
||||
// Let's send in month 25 by accident and create an exception
|
||||
in.str("20012509"); // 2001-??-09
|
||||
in.clear();
|
||||
in.exceptions(std::ios::failbit);
|
||||
cout << "An expected exception is next:\n";
|
||||
cout << "An expected exception is next:" << endl;
|
||||
in >> parse("%Y%m%d", d);
|
||||
cout << "oh oh, you shouldn't reach this line:\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user