|
|||
![]() var record = new ActiveXObject("ADODB.Recordset"); //record.CursorLocation = 3; record.Open("select id,title,src, date ,news from newsTable", conn, 1, 2); // date is a datetype field trace(record.AbsolutePosition); record.MoveFirst(); trace(record.Fields(3).Value.toString()); // got a float string eg 1.2348989e11 // why???? trace(record.Fields(4).Value.toString()); FlashPlayer.bindData("id","bt","ly","rq","lr"); function updateForm() { idx = record.Fields(0).Value; FlashPlayer.id = record.Fields(0).Value.toString(); FlashPlayer.bt = record.Fields(1).Value.toString(); FlashPlayer.ly = record.Fields(2).Value.toString(); FlashPlayer.rq = record.Fields(3).Value.toString(); FlashPlayer.lr = record.Fields(4).Value.toString(); FlashPlayer.updateData(false); } updateForm(); |
|
|||
|
var dat = new Date(record.Fields(3).Value);
var y = dat.getFullYear(); var m = dat.getMonth(); var d = dat.getDay(); FlashPlayer.rq = y+"-"+m+"-"+d; it's show 2005-10-1 I'd like do further say 2005-10-01 for Month and Day's add leading 0 char by condition How can I do that |
|
|||
|
I've done
by following code var dat = new Date(record.Fields(3).Value); var y = dat.getFullYear(); var m = dat.getMonth(); if (m.length=1) m ="0"+m; var d = dat.getDay(); if (d.length=1) d ="0"+d; ......... FlashPlayer.rq = y+"-"+m+"-"+d; is that the right way? |
|
|||
|
var dat = new Date(record.Fields(3).Value);
var y = dat.getFullYear(); //var m = dat.getMonth(); var m = dat.getMonth()+1; if (m.length=1) m ="0"+m; var d = dat.getDay(); if (d.length=1) d ="0"+d; ......... FlashPlayer.rq = y+"-"+m+"-"+d; sorry,small mistake month counted from 0 |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|