dbTalk Databases Forums  

Serial date to clarion date

comp.databases.btrieve comp.databases.btrieve


Discuss Serial date to clarion date in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
yatuchabe@hotmail.com
 
Posts: n/a

Default Serial date to clarion date - 01-02-2005 , 10:01 PM






I have a Clarion serial data that I need to convert to a Btrieve Date.
The clarion serial date is based from 28, dec 1800. That is the first
day. How can I convert it to a Pervasive Date? I'm using Pervasive 8
and I need to create a stored procedure to do this. With Oracle I can
do someting like :
oracle_date := ClarionDate# + to_date('01011900','ddmmyyyy');

For MS-SQL :

set @ClaRoot = 'Dec 28, 1800'
set @MSSQLRoot = 'Jan 01, 1900'
set @SqlDate = @ClaDate - datediff(day,@ClaRoot,@MssqlRoot)
How can thi be acomplished with Pervasive SQL?

TIA
Carlos San Miguel


Reply With Quote
  #2  
Old   
Brad Kunkel
 
Posts: n/a

Default Re: Serial date to clarion date - 01-03-2005 , 01:04 PM






<yatuchabe (AT) hotmail (DOT) com> wrote

Quote:
I have a Clarion serial data that I need to convert to a Btrieve Date.
The clarion serial date is based from 28, dec 1800. That is the first
day. How can I convert it to a Pervasive Date? I'm using Pervasive 8
and I need to create a stored procedure to do this. With Oracle I can
do someting like :
oracle_date := ClarionDate# + to_date('01011900','ddmmyyyy');

For MS-SQL :

set @ClaRoot = 'Dec 28, 1800'
set @MSSQLRoot = 'Jan 01, 1900'
set @SqlDate = @ClaDate - datediff(day,@ClaRoot,@MssqlRoot)
How can thi be acomplished with Pervasive SQL?

TIA
Carlos San Miguel
Carlos,

Clarion has the DATE variable type which conforms to the Pervasive Date spec
and I believe any SQL Date. So if you have a Clarion date in a LONG
variable, just assign it to a DATE variable; the conversion is automatic.
If you create any new tables, use DATE instead of LONG for dates, TIME
instead of LONG for times, and PDECIMAL instead of DECIMAL.

HTH,
Brad Kunkel
Integrated Business, Inc.




Reply With Quote
  #3  
Old   
Bill Bach
 
Posts: n/a

Default Re: Serial date to clarion date - 01-06-2005 , 01:41 PM



SELECT TIMESTAMPADD ( SQL_TSI_DAY, datefield, CONVERT('1800-12-28
00:00:00', SQL_TIMESTAMP) )

Replace "datefield" with your serial date.
Goldstar Software Inc.
Building on Btrieve(R) for the Future(SM)
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Pervasive.SQL Service & Support Classes ***
Coming Soon: Pervasive DataExchange Training!


yatuchabe (AT) hotmail (DOT) com wrote:

Quote:
I have a Clarion serial data that I need to convert to a Btrieve Date.
The clarion serial date is based from 28, dec 1800. That is the first
day. How can I convert it to a Pervasive Date? I'm using Pervasive 8
and I need to create a stored procedure to do this. With Oracle I can
do someting like :
oracle_date := ClarionDate# + to_date('01011900','ddmmyyyy');

For MS-SQL :

set @ClaRoot = 'Dec 28, 1800'
set @MSSQLRoot = 'Jan 01, 1900'
set @SqlDate = @ClaDate - datediff(day,@ClaRoot,@MssqlRoot)
How can thi be acomplished with Pervasive SQL?

TIA
Carlos San Miguel

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.