DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

Displaying as Date Format in Datagridview from Double data type

rated by 0 users
This post has 3 Replies | 2 Followers

Top 500 Contributor
Posts 3
Points 60
zirc.net Posted: 08-07-2008 12:10 AM

 tnx to all ho have answered my query from the past.

again po i'll ask your magnificient kind of thingnking.

my query statement was like this " SELECT cast(MATDATE as DOUBLE)  as 'MATURITY DATE' FROM LNACC"

ang laman po kasi ng MATDATE field ko ay nk number (i.e. 38965 ay equivalent sa Mach 12, 2009(assume lang po itong value nya))

paano ko po ito maidisplay sa DATAGRIDVIEW.

or kahit po sa SELECT STATEMENT nlang po nya convert kung pwede.

tnx. po

 

Not Ranked
Posts 1
Points 20

Hello Zirc.net, here's a sample code for your problem,I hope this helps...


DECLARE @DateValue    datetime

SET @DateValue = CONVERT(datetime,39452);

-- Jan 07, 2008
SELECT CONVERT(varchar,@DateValue,107)

-- January 7, 2008
SELECT DATENAME(month,@DateValue) + ' ' + CONVERT(varchar,DAY(@DateValue)) + ', ' + CONVERT(varchar,YEAR(@DateValue))

 

  • Filed under:
  • | Post Points: 20
Top 500 Contributor
Posts 3
Points 60

 tnx for the reply sir.

sorry i didnt make my query clear

 

i'm accesing foxpro free table like this...

ACC    CHD  MATDATE ---- fields

123     4        39865   ----- field value

234     5        38659

325     6         32651

i use DATASETS to store my query ,my query goes on oledbadpater("SELECT ACC,CHD,MATDATE FROM LNACC",MYCON)

then i use the FILL method. and then set is as the DATA SOURCE of my DATAGRIDVIEW.

what i want is how i can display the MATDATE value into DATE Format instead the 39865,38659 eth.

thnx

  • | Post Points: 20
Top 10 Contributor
Posts 1,967
Points 39,325

 hi zirc.net,

I don't know how to do the proper query in foxpro but i do know how you can create a workaround for this issue in code. One of the things that always do is I try not to code against a dataset. Every time i retrive my data I always put it on it's own object(class) and build my processing logic from there. You could then create a DateTime property that would correspond to your double value by doing DateTime conversion. You can the use DateTime.FromOADate() to convert your numeric value to DateTime.

HTH

 

devpinoy sig

  • | Post Points: 5
Page 1 of 1 (4 items) | RSS

Copyright DevPinoy 2005-2008