dbTalk Databases Forums  

Odd Date Format....what is real date

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss Odd Date Format....what is real date in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Monica J. Braverman
 
Posts: n/a

Default Odd Date Format....what is real date - 05-24-2004 , 09:24 PM






I've been presented with a numeric field in this format 2003032

The 2003 is the year. The 032 is the 32nd day of the year which would
translate this date into 02/01/2003.

Is there anything set up in Foxpro to convert this for me or does
anyone have a good idea of how to do it?

Thanks.

Monica

Reply With Quote
  #2  
Old   
Stefan Wuebbe
 
Posts: n/a

Default Re: Odd Date Format....what is real date - 05-25-2004 , 02:00 AM






"Monica J. Braverman" <monica (AT) datashark (DOT) net> schrieb im Newsbeitrag
news:d70cd025.0405241824.76f37370 (AT) posting (DOT) google.com...
Quote:
I've been presented with a numeric field in this format 2003032

The 2003 is the year. The 032 is the 32nd day of the year which would
translate this date into 02/01/2003.
Hi, This seems to work

? DayNumber(2003032)

Function DayNumber(tnCustomDate)
Local nYear, nDayNo
nYear = Floor(m.tnCustomDate / 1000)
nDayNo = m.tnCustomDate - m.nYear * 1000

Return Date(m.nYear,1,1) + m.nDayNo - 1
EndFunc


hth
-Stefan



Reply With Quote
  #3  
Old   
Robert Hoogstraat
 
Posts: n/a

Default Re: Odd Date Format....what is real date - 05-25-2004 , 10:33 AM



Assuming the field name is julian_date which contains the 7 character string
'2003032' where the first four character are the year and the last three
character are the day number, then the conversion to get the data value can
be as follows:
SYS(10,VAL(SYS(11,EVAL('{^'+SUBSTR(julian_date,1,4 )+'-01-01}')))+VAL(SUBSTR(
julian_date,5,3)))


--
Robert Hoogstraat
Software Intellect

"Monica J. Braverman" <monica (AT) datashark (DOT) net> wrote

Quote:
I've been presented with a numeric field in this format 2003032

The 2003 is the year. The 032 is the 32nd day of the year which would
translate this date into 02/01/2003.

Is there anything set up in Foxpro to convert this for me or does
anyone have a good idea of how to do it?

Thanks.

Monica



Reply With Quote
  #4  
Old   
Robert Hoogstraat
 
Posts: n/a

Default Re: Odd Date Format....what is real date - 05-25-2004 , 10:38 AM



Error correction, the conversion should read:
SYS(10,VAL(SYS(11,EVAL('{^'+SUBSTR(julian_date,1,4 )+'-01-01}')))+VAL(SUBSTR(
julian_date,5,3))-1)


Robert



Reply With Quote
  #5  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: Odd Date Format....what is real date - 05-25-2004 , 04:20 PM



monica (AT) datashark (DOT) net (Monica J. Braverman) wrote:

Quote:
I've been presented with a numeric field in this format 2003032

The 2003 is the year. The 032 is the 32nd day of the year which would
translate this date into 02/01/2003.

Is there anything set up in Foxpro to convert this for me or does
anyone have a good idea of how to do it?
yyddd="2003032"
yymmdd=date(val(left(yyddd,4)),1,1)+(val(right(yyd dd,3))-1)

Sincerely,

Gene Wirchenko


Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.