Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-02-2005, 02:18 PM
Member
 
Join Date: Oct 2005
Posts: 87
Default Access 2003 query DATE field problem


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();
Reply With Quote
  #2 (permalink)  
Old 11-03-2005, 09:56 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Access 2003 query DATE field problem

Please try
Code:
trace(new Date(record.Fields(3).Value));
Reply With Quote
  #3 (permalink)  
Old 11-04-2005, 07:17 AM
Member
 
Join Date: Oct 2005
Posts: 87
Default Re:Access 2003 query DATE field problem

thanks , I'll try
Reply With Quote
  #4 (permalink)  
Old 11-04-2005, 07:28 AM
Member
 
Join Date: Oct 2005
Posts: 87
Default Re:Access 2003 query DATE field problem

I've tried, I'ts return's
Sat Oct 01 08:00:00 GMT+800 2005

I'd like format it to something like 2005-10-1

how can I do that?

Reply With Quote
  #5 (permalink)  
Old 11-04-2005, 07:38 AM
Member
 
Join Date: Oct 2005
Posts: 87
Default Re:Access 2003 query DATE field problem

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
Reply With Quote
  #6 (permalink)  
Old 11-04-2005, 07:44 AM
Member
 
Join Date: Oct 2005
Posts: 87
Default Re:Access 2003 query DATE field problem

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?

Reply With Quote
  #7 (permalink)  
Old 11-08-2005, 08:06 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Access 2003 query DATE field problem

Sure
Reply With Quote
  #8 (permalink)  
Old 11-18-2005, 11:15 AM
Member
 
Join Date: Oct 2005
Posts: 87
Default Re:Access 2003 query DATE field problem

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
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:03 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.