Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,894 questions

51,825 answers

573 users

How to get the current date in Dart

2 Answers

0 votes
import 'package:intl/intl.dart';

main() {
  final DateFormat formatter = DateFormat('yyyy-MM-dd');
  
  final String date = formatter.format(DateTime.now());
  
  print(date); 
}
 
 
 
 
/*
run:
 
2022-10-16
 
*/

 



answered Oct 16, 2022 by avibootz
0 votes
main() {
  final DateTime now = DateTime.now();
  
  print(now); 
}
 
 
 
 
/*
run:
 
2022-10-18 23:19:39.856
 
*/

 



answered Oct 18, 2022 by avibootz

Related questions

1 answer 92 views
1 answer 121 views
1 answer 153 views
2 answers 156 views
156 views asked Mar 25, 2023 by avibootz
1 answer 118 views
118 views asked Dec 9, 2022 by avibootz
1 answer 113 views
1 answer 116 views
116 views asked Oct 20, 2022 by avibootz
...