:: Forum >>

datetime formating

Noted a previous topic about sorting mysql DATETIME columns, but no response. To get around the time problem, I decided to format these columns manually instead of using Formats.Date, as a raw DATETIMR would sort well as a string anyway, and used the setDataText to reformat them to dd/mm/yyyy hh:mm:ss


obj.setDataText(
function(i, j){
if (j==0) {
var j_str = myData[i][j].split(' ');
var j_date = j_str[0].split('-');
//j_time = j_str[1].split(':');
return j_date[2]+'/'+j_date[1]+'/'+j_date[0]+' '+j_str[1];
     }else{
return formats[j].dataToText(myData[i][j]);
}
}
);

(appologies if that didn't paste well, no preview)

what I would like to know is if this would be faster using regular expressions (and if so, could anyone offer the correct expression for converting yyyy-mm-dd hh:mm:ss into dd/mm/yy hh:mm:ss) or if I should really be doing with with Format.String somehow.

thanks, Zach.
Zachary Powell
Tuesday, April 19, 2005

This topic is archived.


Back to support forum

Forum search