first commit

This commit is contained in:
kicap
2023-08-18 01:07:57 +08:00
commit 3b437c4f82
320 changed files with 10503 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import 'package:intl/intl.dart';
class OtherFunction {
int umur(String tanggalLahir) {
// change tanggalLahir to DateTime
DateTime date = DateTime.parse(tanggalLahir);
// get current date
DateTime now = DateTime.now();
// get difference in year
int year = now.year - date.year;
return year;
}
String commaFormat(int number) {
final formatter = NumberFormat('#,###');
return formatter.format(number);
}
String timeStampConverter(int timeStamp) {
DateTime date = DateTime.fromMillisecondsSinceEpoch(timeStamp * 1000);
// day name, date and hours with am/pm
String formattedDate = DateFormat('EEEE, d MM-yyyy | HH:mm a').format(date);
return formattedDate;
}
}