Created
April 24, 2013 11:14
-
-
Save amscotti/5451406 to your computer and use it in GitHub Desktop.
Throws FormatException,
Input DateTime is 2013-04-24 07:12:25.516, which formats to 201304240712
FormatException: Trying to read MM from 201304240712 at position 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:intl/intl.dart'; | |
void main() { | |
var dateFormat = new DateFormat("yyyyMMddHHmm"); | |
DateTime now = new DateTime.now(); | |
String strDate = dateFormat.format(now); | |
print("Input DateTime is ${now}, which formats to ${strDate}"); | |
try { | |
var output = dateFormat.parse(strDate); | |
print("Output DateTime is ${output}, from the String ${strDate}"); | |
} catch (e) { | |
print(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment