Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
37%
Installation Wizard into new VRC
39%
Manual into existing VRC
3%
Manual into new VRC
21%
Total votes: 38

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 14th February 2002, 22:43
candle1113 candle1113 is offline
Junior Member
 
Join Date: Jan 2002
Posts: 6
candle1113 is on a distinguished road
Is there a GMT to local time function in BaaN

In Java there is a method toLocaleString() which will convert a date/time string from UTC/GMT time to the local system time. Is there a comparable function/method in BaaN script?
I am accessing the job history records and they are stored in GMT time and I need to easily convert them to Eastern Standard Time (taking daylight savings time into account when needed).
Reply With Quote
  #2  
Old 14th February 2002, 23:14
lbencic's Avatar
lbencic lbencic is offline
Guru
 
Join Date: Dec 2001
Location: Lisle, IL, USA
Posts: 1,148
lbencic will become famous soon enough
Baan: 2.2d - LN - DB: most - OS: most
In Baan 5 there is the predefined functions:
utc.to.local (long utc, ref long local_days, ref long local_time)
local.to.utc(long local_days, long local_time, ref long utc)
Where local days = Number of days since 1-1-01 and
local time = number of seconds since 00:00.

UTC functionality is new to Baan 5.

These functions do not exist in Baan 4. But, in 4, you can use the functions:
long date.to.num(long yearno, long monthno, long month_day)
long num.to.date(long dayno, ref long yearno, ref long monthno, ref long month_dayno)
to do some similar workings with Baan 4's stored date number (not in UTC format).
Reply With Quote
  #3  
Old 14th February 2002, 23:49
Kees de Jong's Avatar
Kees de Jong Kees de Jong is offline
Senior Member
 
Join Date: Jan 2002
Location: Ede, The Netherlands
Posts: 164
Kees de Jong is on a distinguished road
Baan: MK, BaanIV, B5.0b until LN - DB: - - OS: Unix; AS/400; Windows2000
Other usefull functions are:

utc.to.date ( long utc, ref long yearno, ref long monthno, ref long month_dayno, ref long hours, ref long minutes, ref long seconds )

This converts a UTC long format value to the corresponding year, month, day, and so on, in local time.

---

utc.to.week ( long utc, ref long week_dayno, ref long year_dayno, ref long weekno, ref long hours, ref long minutes, ref long seconds [, ref long yearno] )

This converts a UTC long format value to the corresponding day of the week, day of the year, week of the year, and so on, in local time.

Arguments
- dayno: The UTC long format value.
- week_dayno: The day of the week. This depends on which day is defined as the first day of the week in the user data settings in the data dictionary.
- year_dayno: The day number in the year.
- weekno: The week number in the year.
- hours, minutes, seconds: The time of day.
- yearno: The year number. This argument is optional.

---

utc.to.input ( long lvalue, const string format() )

This converts a UTC long format value to an input date string or an input time string (in local time). The format specified determines whether the function returns a date string or a time string.

Arguments
- lvalue: A UTC long format value.
- format: The format for the input string. For a UTC date, use the substitution symbols %uxxx[,lang] or %u(format). For a UTC time, use the substitution symbols %Uxxx[,lang] or %U(format).

---

And of course the other way around:
date.to.utc()
week.to.utc()
input.to.utc()

Regards,
Baan5user

Last edited by Kees de Jong : 14th February 2002 at 23:54.
Reply With Quote
  #4  
Old 19th February 2002, 02:12
candle1113 candle1113 is offline
Junior Member
 
Join Date: Jan 2002
Posts: 6
candle1113 is on a distinguished road
BaaN4c4 User

Unfortunately, we are only using BaaN4c4 so I guess I will have to make my own home-grown UTC to local time functions.

I appreciate everyones help.
Reply With Quote
  #5  
Old 19th February 2002, 02:31
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,032
NPRao will become famous soon enough
Baan: iBaanERP-5.2a(Reger),SSA-ERP-LN-6.1,Infor LN-10.x - DB: Oracle-10g,11g,12c,MS-SQL - OS: HP-UX, Linux, Windows
In addition you can also use the function -

Syntax

long set.time.zone( string time_zone(50) )

Description

This sets the local time zone at run time.

Return values

0 success
-1 error

Context

Bshell function.
Reply With Quote
Sponsored Links
  #6  
Old 19th February 2002, 18:58
candle1113 candle1113 is offline
Junior Member
 
Join Date: Jan 2002
Posts: 6
candle1113 is on a distinguished road
UTC.TO.LOCAL

I finally found this functon in Knowledge Quest (which I believe is for Baan 4)
long UTC.TO.LOCAL ( ref long local_days,
ref long local_time,
long utc_days,
long utc_time )

The brief explanation of this function is:
This function converts the Coordinated Universal Time to the local time. The 'utc_days' argument must be specified as the number of days since 01-01-0001. The utc time must be specified in seconds. The return value of this function can be zero (OK) or 1 (error).

I'm still not sure how I would use this to convert the date field ttaad511.sdts (domain ttdate) and time field ttaad511.stis (domain ttdate) in the job managment table ttaad511 from UTC to local date and time on a report.

Anybody have any input?
Reply With Quote
  #7  
Old 19th February 2002, 19:23
evesely's Avatar
evesely evesely is offline
Guru
 
Join Date: Dec 2001
Location: Lisle, Illinois USA
Posts: 412
evesely is on a distinguished road
Thumbs up

In your report script, define the variables local_date and local_time (or something similar) as externs. Then in the appropriate layout's before.layout subsection of your report, call:
Code:
utc.to.local(local_date, local_time, ttaad512.sdts, ttaad512.stis)

You can then put local_date and local_time in your layout on the report.
Reply With Quote
  #8  
Old 19th February 2002, 19:34
lbencic's Avatar
lbencic lbencic is offline
Guru
 
Join Date: Dec 2001
Location: Lisle, IL, USA
Posts: 1,148
lbencic will become famous soon enough
Baan: 2.2d - LN - DB: most - OS: most
UTC Ported to Baan IV

Well, I'm sure you figured this out by now, but the UTC functions have been ported to Baan IV now. Sorry for the mis-info.

The IV format allows for UTC Date and UTC Time in separate fields, where in Baan V, they are one field. So, the syntax for the functions is different in IV than what we listed for you. The Knowlwedge Quest seems most up to date!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between an Automation Server and a Function Server? NPRao AFS/DDC/OLE: Function servers 1 14th September 2002 00:47
Baan World Users conference in Orlando chadwickh General Discussion & Chat 7 3rd November 2001 22:55
Availability of Web-Based DEM (Baan Press Release) Pierre B. General Discussion & Chat 0 5th September 2001 06:59
BSP-US (LLC) added as a Baan Education Alliance svandenh General Discussion & Chat 1 20th August 2001 20:44
Fehlerhafte Rabattfindung in C4 Kai's Forum Users Deutsches Forum 2 9th January 2001 01:00


All times are GMT +2. The time now is 20:28.


©2001-2017 - Baanboard.com - Baanforums.com