Answers for "firebase timestamp to date flutter"

2

flutter firestore timestamp to datetime

DateTime.parse(timestamp.toDate().toString())
Posted by: Guest on November-06-2020
5

flutter date time to timestamp

DateTime currentPhoneDate = DateTime.now(); //DateTime

Timestamp myTimeStamp = Timestamp.fromDate(currentPhoneDate); //To TimeStamp

DateTime myDateTime = myTimeStamp.toDate(); // TimeStamp to DateTime

print("current phone data is: $currentPhoneDate");
print("current phone data is: $myDateTime");
Posted by: Guest on June-22-2020
0

flutter timestamp to datetime

Timestamp t = document['timeFieldName'];
DateTime d = t.toDate();
print(d.toString()); //2019-12-28 18:48:48.364
Posted by: Guest on October-28-2021
0

flutter timestamp to datetime

Map<String, dynamic> map = docSnapshot.data()!;
DateTime dt = (map['timestamp'] as Timestamp).toDate();
Posted by: Guest on October-28-2021
0

flutter firebase timestamp

Future<List<Post>> getAllPost(Post lastFetched, int fetchLimit) async {
    List<Post> _postList = [];
    if (lastFetched == null) {
      _querySnapshot = await Firestore.instance
          .collection("posts")
          .orderBy("liked", descending: true)
          .limit(fetchLimit)
          .getDocuments();
    } else {
      _querySnapshot = await Firestore.instance
          .collection("posts")
          .orderBy("liked", descending: true)
          .startAfterDocument(lastDocument)
          .limit(fetchLimit)
          .getDocuments();
    }
    if (_querySnapshot.documents.length != 0) {
      lastDocument =
          _querySnapshot.documents[_querySnapshot.documents.length - 1];
    }

    for (DocumentSnapshot documentSnapshot in _querySnapshot.documents) {
      Post tekPost = Post.fromMap(documentSnapshot.data);
      _postList.add(tekPost);
    }
    return _postList;
  }
Posted by: Guest on May-04-2021

Code answers related to "firebase timestamp to date flutter"

Code answers related to "Dart"

Browse Popular Code Answers by Language