abby13
27th February 2009, 13:03
Hi All,

how to convert one date format to other?

For eg :- there is a date string like "28-Dec-2008"
How to convert it to "28-12-2008"?


regards,

abby13

bdittmar
27th February 2009, 13:59
Hi All,

how to convert one date format to other?

For eg :- there is a date string like "28-Dec-2008"
How to convert it to "28-12-2008"?


regards,

abby13

Hello,

if datestring format is like 99-AAA-9999 (eg 01-Jan-2009)

built 12 case instructions (one for every month)
........
case datestring(4;3) = "Dec"
monthnum = "12"
newdatestring = datestring(1;2)&"-"&monthnum&"-"&datestring(8;4)
...........

Regards

abby13
27th February 2009, 14:23
Hi Bernd,

Thanks Bernd for the reply.

I have done it already as you suggested.

But is there any Baan standard function to do the same?

Thanks,

abby13

bdittmar
27th February 2009, 14:32
Hi Bernd,

Thanks Bernd for the reply.

I have done it already as you suggested.

But is there any Baan standard function to do the same?

Thanks,

abby13

Hello abby13,

in ttadv4180m000 (Maintain Date Formats)

Date Format : 002
Description : Day, Month, Year (Gen. 10 pos)
Day Name : None
Day Number : In month
Week Number : None
Month Name : None
Month Number : Number
Year Number : With century
Separator Indicator : Language Separator
Separator :
Zero Fill : Yes
Length : 10
Input Month Number/Week Number : Month number

--------------
Month Name

Indicates how the month name should be shown.

complete
The complete month name will be shown.
E.g. : January, February, March etc.
abbreviated
The month name will be shown abbreviated (3 characters long).
E.g. : Jan, Feb, Mar etc.
none
The month name will not be shown.

Assign another date format !

Regards

Pravin Sonar
3rd March 2009, 12:05
hi,
Try below function it may help you,
use format as u want and explained by bdittmar,

1) function long inputstr.to.date (string inputstr(.), string format(7))Description:
This converts a date input string to the number of days since 01-01-0001.
Arguments:
string inputstr(.) The date input string, possibly input by the user and retrieved using the function data.input().
string format(7) Indicates the format of the input string, specified by using the substitution symbols %D xxx [, lang ].


2)function string date.to.inputstr$ (long dayno, string format(7), long length)
Description:
This converts a specified number of days since 01-01-0001 to a date input string.
Arguments:
long dayno A number of days since 01-01-0001.
string format(7) The format for the date string, specified by using the substitution symbols %Dxxx[,lang]
long length The length of the date string:
6: year represented by 2 characters (century not included)
8: year represented by 4 characters (century included)

regards,
pravin

Harish chowdary
19th March 2009, 12:07
Hi All
If i do date - date(ex:whinh312.date-whinh312.tdat) i.e 25.10.2008-22.10.2008
then i must get 3 days, and if time is there it must cinsider that also
Please give me the solution.
Thanks & Regards
Harish

MilindV
5th May 2009, 13:36
Hi

I am getting date as string in format yy-mm-dd.
I want to convert it into long to store in baan table.
I am using function date.to.num().
This function has first arg as year but it expects year as 4 digit (means with century).
Now, To convert input string yy to yyyy, is there any standard function or any dll function?

right now i m doing:
year.no = lval(date.str(1;2))
if year.no >= 70 and year.no <= 99 then
year.no = year.no + 1900
else
if year.no >= 0 and year.no <= 38 then
year.no = year.no + 2000
endif
endif

Any feed back will be appreciated.

Thanks All
MilindV

Marioth
5th May 2009, 16:23
Hi,

First of all use this function:

num.to.date$()
Syntax:

function 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

long dayno A number of days since 01-01-0001.

long 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

This function can be used in all script types.

And then use mode 2 to get the correct year.

Regards,

Mario

Marc Jenkins
6th May 2009, 12:56
Hi all

This is a one click setting in the AutoFORM LaserNet output management tools for BAAN, which makes both converting dates, and numbers to different international styles, quick and simple to do. Saves a lot of hard code programming:)

Please see http://www.efstechnology.com/output-create-forms-in-minutes.html

The procedure works for both form design and also dropping down data into databases.

Hope this helps