Answers for "add both date and time in flutter"

3

flutter datetime add hours

var today = new DateTime.now();
var fiftyDaysFromNow = today.add(new Duration(hours: 1));
Posted by: Guest on February-27-2020
4

flutter date time

var now = new DateTime.now();
var moonLanding = DateTime.parse(now);

moonLanding.year; 
moonLanding.hour;  
moonLanding.month; 

moonLanding.year.toString() + '-' + moonLanding.month.toString() + '-' + moonLanding.day.toString()

############################ OR ###########################

import 'package:intl/intl.dart';

var dt = DateTime.now();
var newFormat = DateFormat("yy-MM-dd");
String updatedDt = newFormat.format(dt);
print(updatedDt); // 20-04-03

var newDt = DateFormat.yMMMEd().format(dt);
print(newDt);  // Fri, Apr 3, 2020

reference :
https://medium.com/flutter-community/working-with-dates-in-dart-e81c70911811
Posted by: Guest on February-28-2021

Code answers related to "add both date and time in flutter"

Browse Popular Code Answers by Language