skheeb
29th May 2002, 16:01
Does anyone have a script that can be used in UNIX to convert a baan date to a regular date and vice versa? Or is there something in Baan that I don't know about?

gguymer
29th May 2002, 16:26
How are you planning to access your date in UNIX? From the database? What database are you using? Baan stores date fields in the underlying database you chose for it and that determines how it comes out. Or, are you trying to get the system date that Baan Tools accesses from UNIX. What UNIX flavor are you using? We use Oracle8i and IBM AIX 4.3 (UNIX) on IBM RS6000's.

Gilbert Guymer
Database Administrator
Lufkin Industries, Inc.

skheeb
29th May 2002, 16:33
I just need some kind of conversion tool. Don't necessarily need to access the data in the database. But here is the information you requested.

We are running HPUX 11.0 for our OS. Our Database is Oracle 8i.

gguymer
29th May 2002, 16:46
I'm still not sure what it is you're trying to do, but dates in Baan are no different than dates in the operating system. Are you referring to formats? Tell me more about what you are wanting to do and why. In UNIX there is a command called "date" and it has a number of formatting options. Just do a "man date" to get the manual pages to display the command syntax.

Gilbert Guymer
Database Administrator
Lufkin Industries, Inc.

skheeb
29th May 2002, 16:55
In Baan, if you use the baandate in exchange, it converts the date from the number of days since 01/01/0001. When creating baan jobs, baan stores this date in this numeric value. We a re running a series of archiving jobs, that we need to periodically change the date. Since it is stored in the ttaad503 table as the baandate value, I need a tool that I can just type in the date and have it convert it to the number of days since 01/01/0001. This will save us having to delete the session and recreate in the job with the new date value as we can just change the numeric value for the date in this table.

gguymer
29th May 2002, 19:27
I believe that this might help.

Multiply the year of by 365.25 to get the numbers of days up to the first day of that year. You then need to calculate the number of days to the first of the month. If month equals 2 and the year divided by four with no remainder is then 31 + 29 otherwise it would be 31 + 28. Then add in the day to the total to get the Baan date.

Julian dates starting with 0 equal 01/01/4712 BC. Knowing this you might be able to use the difference of 1721424 days (the difference between Julian and Baan start dates) to fool the system into generating what you want as well.

skheeb
29th May 2002, 20:13
Thanks for the input.

Francesco
30th May 2002, 10:11
I smell a y2k bug here ;)

Complete centuries are not a leap year, despite the fact that there is no remainder.... except for millennia, that ARE leap years...and...and...oh no...not again.

oh...btw, did I mention daylight saving time?

Originally posted by gguymer
I believe that this might help.

Multiply the year of by 365.25 to get the numbers of days up to the first day of that year. You then need to calculate the number of days to the first of the month. If month equals 2 and the year divided by four with no remainder is then 31 + 29 otherwise it would be 31 + 28. Then add in the day to the total to get the Baan date.

Julian dates starting with 0 equal 01/01/4712 BC. Knowing this you might be able to use the difference of 1721424 days (the difference between Julian and Baan start dates) to fool the system into generating what you want as well.

NPRao
30th May 2002, 10:24
Hi Skeeb,

I wonder if you considered using the available BaaN Standard functions like -


Syntax

long date.to.num( long yearno, long monthno, long month_dayno )

Description

This returns the number of days since 01-01-0001 for a specified year, month, and day of the month.

Return values

The number of days since 01-01-0001. Or -1 if an error occurs.

Context

Bshell function.

Example

long no_of_days

no_of_days = date.to.num( 1991, 04, 20 ) | Returns 726942


and also,


Syntax

string num.to.date$( long dayno, long mode )

Description

This converts a specified number of days since 01-01-0001 to the corresponding date, formatted as a date string. The sequence of day, month, and year in the string depends on the user data settings defined in the data dictionary. The separator character used is also defined in the data dictionary.

Arguments

dayno A number of days since 01-01-0001.
mode Specifies certain characteristics of the date string format:0: Year as YY without separators (for example, “311290”)
1: Year as YY with separators (for example, “31/12/90”)
2: Year as YYYY without separators (for example, “31121990”)
3: Year as YYYY with separators (for example, “31/12/1990”).
Return values

The formatted date string. Or an empty string if an error occurs.

Context

Bshell function.

skheeb
30th May 2002, 14:13
NPRao,

This is what I needed. Thank you very much!

Djie-En
4th June 2002, 12:43
Hi,

The below mentioned program, i got it from BAAN, will help you
if you want to see it on your desktop (Windows)

GN

skheeb
7th June 2002, 15:57
This is even better! Thank you very much, this will make things so much easier.