learner
11th January 2003, 07:43
hi,
how can i get the current date ? please tell me also the domain or data type which i will use for it.
i require this current date to further compare it with another date which is stored in table.
morpheus
11th January 2003, 08:04
Use date.num() for the system date, and you can use domain tcdate.
Renegade
11th January 2003, 17:41
IN case u use BaanERP, u may like using utc.num()
It gives u the time along with date
Paul P
13th January 2003, 02:53
Dear learner,
You can also use the built in variable date$. It is a string of length 6 and will give the current date in form of DDMMYY
Rgds,
Paul
sbakshi
13th January 2003, 15:55
Hi,
string new.date(8)
string help.date(12)
help.date=dte$()
new.date=help.date(3;2)&"/"&help.date(1;2)&"/"&help.date(5;2)
new.date now contains today in the format dd/mm/yy
Thnx
Sanjiv
ltannous
13th January 2003, 23:10
when using date.num(), that returns the date, how can I figure out if today is Monday or Tuesday...
sbakshi
13th January 2003, 23:15
Hi,
domain tcdate date, wekd
date = date.num()
wekd = 1+(date\7) | or
wekd = 1+ (date.num() )\7
Explanation:
(date.num() ) \7
The above expression returns the remainder between zero and 6.
As Baan starts counting from 1, we add one to get 1 through 7.
1 always represents Sunday, and 7 represents Saturday.
Thanks
Sanjiv
NPRao
13th January 2003, 23:47
Refer to the tools manual for - sprintf$() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_formatting_io_sprintf)
%D(format)
Use for dates.
This option enables you to define your own date format by using the following subformats of the %D format:
%a name of day (Sun - Sat)
(abbreviated)
%A name of day (Sunday - Saturday)
lbencic
14th January 2003, 00:04
The day of the week is dependent of your First Day of the week setup in Maintain Companies. The same division etc. and hardcoding will only work for specific companies. If you change the first day of the week, or move the code to a company with a different first day of the week, it will act differently. (Ugh..I know from bad experiences!).
The way Baan does this is to have created a function (in Baan IV) to use. I use this as follows:
long current.week.dayno, current.year.dayno, current.week, current.year
domain tcdate current.date
domain tcdayn current.dayn
current.date = date.num()
num.to.week(current.date, current.week.dayno,
current.year.dayno, current.week, current.year)
current.dayn = itihra0001.convert.daynumber.to.dayname(current.week.dayno)
Then the enumerated variable current.dayn will have the correct day of the week, regardless of your first day of week.
This requires the source code for the standard Baan function tihra0001. Even if you do not have source code in general, you should be able to request this source from Baan. I have found they will give out the 'building block' functions needed to get everything else working.
Edit: I just saw Rao's post. The sprintf option can also be very handy!