Danny Tuppeny
2016-08-25 10:46:03 UTC
I've got a string like this that I need to parse:
01/02/16 12:11:12
The format is dd/MM/yy hh:mm:ss. I'm parsing it like this:
import 'package:intl/intl.dart';
final dateFormat = new DateFormat("d/M/y H:m:s");
main() {
date = dateFormat.parse("01/02/16 12:11:12");
}
However the year comes out at 0016. I can't find any option to parse a two
digit year, I can't manipulate the year property of what comes back (year
on DateTime is readonly) and the add method takes a duration which only
accepts days, no years! :-(
01/02/16 12:11:12
The format is dd/MM/yy hh:mm:ss. I'm parsing it like this:
import 'package:intl/intl.dart';
final dateFormat = new DateFormat("d/M/y H:m:s");
main() {
date = dateFormat.parse("01/02/16 12:11:12");
}
However the year comes out at 0016. I can't find any option to parse a two
digit year, I can't manipulate the year property of what comes back (year
on DateTime is readonly) and the add method takes a duration which only
accepts days, no years! :-(
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.