is there a datetime with only time flutter code example

Example 1: how to show date only in flutter

import 'package:intl/intl.dart';
String now = DateFormat("yyyy-MM-dd").format(DateTime.now());

Example 2: how to show date only in flutter

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Current Date Example',
      home: DateExample(),
    );
  }
}


class DateExample extends StatelessWidget {
  const DateExample({Key key}) : super(key: key);

  
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(child: Text(DateFormat("yyyy-MM-dd").format(DateTime.now()))),
    );
  }
}

Tags:

Dart Example