Ok, here is a class to be able to get the same date format for your files on your system and on the ftp (not the case for now)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | /* * Class written by Xavier MARTIN (xxlm or zeflasher) * http://dev.webbymx.net * http://www.webbymx.net * If you are using this class, I will be glad to receive a postcard of your place :) * To do so please visit http://dev.webbymx.net and go in the about page to get my details... */ class net.webbymx.zinc.DateManager { // ftp to full date public static function ftpDate (d : String) : Date { // spliting the string var tmpDateTime : Array = d.split (" "); // working with time var hour : Number = parseInt (tmpDateTime [1].split (":")[0]); var minute : Number = parseInt (tmpDateTime [1].split (":")[1]); if (tmpDateTime [2] == "PM") hour += 12; if (hour == 24) hour = 0; var tmpArray : Array = tmpDateTime [0].split ("/"); var buffer : String = tmpArray [0]; tmpArray [0] = parseInt (tmpArray [1]); tmpArray [1] = parseInt (buffer) - 1; tmpArray [2].length > 2 ? tmpArray [2] = parseInt (tmpArray [2]) : tmpArray [2] = parseInt ("20" + tmpArray [2]); tmpArray [3] = hour; tmpArray [4] = minute; var tmpDate : Date = new Date (tmpArray [2] , tmpArray [1] , tmpArray [0] , tmpArray [3] , tmpArray [4]); return tmpDate; } public static function fileDate (d : String, t : String) : Date { // spliting the string var tmpArray : Array = d.split ("/"); // dealing with time var clock : Array = t.split (":"); var hour : Number = parseInt (clock [0]); if (hour == 24) hour = 0; var minute : Number = parseInt (clock [1]); // setting up the array tmpArray [0] = parseInt (tmpArray [0]); tmpArray [1] = parseInt (tmpArray [1]) - 1; tmpArray [2] = parseInt (tmpArray [2]); tmpArray [3] = hour; tmpArray [4] = minute; // sending back the date object var tmpDate : Date = new Date (tmpArray [2] , tmpArray [1] , tmpArray [0] , tmpArray [3] , tmpArray [4]); return tmpDate; } } |
[Download id not defined]