GrishinEV
14th February 2012, 17:30
Hello All,
Can somebody make an example how to convert UTC to Date.
Many Thanks!

bdittmar
14th February 2012, 18:01
Hello All,
Can somebody make an example how to convert UTC to Date.
Many Thanks!

Hello,
this conversion has been discussed a serveral times.
Use sprintf$ function, please.

http://www.baanboard.com/programmers_manual_baanerp

or

utc.to.date()
Syntax:

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

Description


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


Arguments

long utc
ref long yearno
ref long monthno
ref long month_dayno
ref long hours
ref long minutes
ref long seconds


Regards

GrishinEV
14th February 2012, 18:18
Hello,
this conversion has been discussed a serveral times.
Use sprintf$ function, please.

http://www.baanboard.com/programmers_manual_baanerp

or

utc.to.date()
Syntax:

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

Description


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


Arguments

long utc
ref long yearno
ref long monthno
ref long month_dayno
ref long hours
ref long minutes
ref long seconds


Regards

i know both of this function but it doesnot work!

now can help function utc.to.date ?
maybe somebody has enuther solutoin?

mark_h
14th February 2012, 21:39
In what way does it not work? Maybe post your code. You can also try search this forum for examples using utc and date. You might find an example.

v_kewl
15th February 2012, 08:26
|* date.with.time - Date in UTC
|* date.without.time - Date

utc.to.date(date.with.time, o.year, o.mnth, o.dayn, o.hr, o.mn, o.sc)

date.without.time = date.to.num(o.year, o.mnth, o.dayn)

Regards,
Gaurav

bdittmar
15th February 2012, 13:02
i know both of this function but it doesnot work!

now can help function utc.to.date ?
maybe somebody has enuther solutoin?

Hello,

as Mark suggest, be more specific, please.

Post your code and describe your problem.

Describe, what you'll achieve.

Regards

BaanInOhio
15th February 2012, 21:33
If you are on LN, use utc.to.local() instead:


domain tcdate your.date | utc
domain tfgld.date short.date | not utc
long your.time | seconds

your.date = utc.num() | for current date
ret = utc.to.local(your.date, short.date, your.time) | fin.date is returned


You can easily go the other way:

short.date = date.num() | for current date
your.time = 0 | start of day, calc seconds past midnight for specific time
ret = local.to.utc(short.date, your.time, utc.date) | utc.date is returned


ret = 0 when success, -1 otherwise.

joepte
13th April 2012, 18:57
when reading a table with a time field can I make a rough calculation the time is the second count from midnight?
i.e does 45500 = (45500/(60*60)) ~ 12.64 hrs or 12:38 pm?

I just want tto have an idea when an event occured I don't want to write a session ...