-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Emerson Bernardino
authored and
Emerson Bernardino
committed
Apr 22, 2012
1 parent
2a57dc7
commit bfe9c04
Showing
3 changed files
with
29 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
UtilsTest.dart | ||
SaldoUnico.dart | ||
BilheteUnicoTest.dart | ||
SaldoUnico.dart | ||
UtilsTest.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
class Utils { | ||
static String formatDate(Date date){ | ||
String dia = date.day.toString(); | ||
String mes = date.month.toString(); | ||
String dia = twoDigits(date.day.toString()); | ||
String mes = twoDigits(date.month.toString()); | ||
String ano = date.year.toString(); | ||
if(dia.length == 1){ | ||
dia = "0$dia"; | ||
} | ||
if(mes.length == 1){ | ||
mes = "0$mes"; | ||
} | ||
|
||
return "$dia/$mes/$ano"; | ||
} | ||
|
||
static String formateDateFromTo(Date date){ | ||
|
||
String dia = twoDigits(date.day.toString()); | ||
String mes = twoDigits(date.month.toString()); | ||
String ano = date.year.toString(); | ||
|
||
String dateStr = "$ano$mes$dia"; | ||
|
||
|
||
//20060415T180000Z/20060415T190000Z | ||
return "$dateStr"+"T050000Z/$dateStr"+"T060000Z"; | ||
|
||
} | ||
|
||
static String twoDigits(String str){ | ||
if(str.length == 1){ | ||
str = "0$str"; | ||
} | ||
return str; | ||
} | ||
|
||
} |