yogesh kapil
28th June 2012, 10:43
Hi,

My date domain is tfgld.date. I want to subtract 1 month from the current date. When I try to use utc.add() function it doesn’t work.

when i try to use date.to.utc() to convert date into utc date format.

long date.to.utc (long year no, long month no, long month_day no, long hours, long minutes, long seconds)

for this i need to bifurcate my date. sprintf$ function also need utc date format.

please help me what should i do.

bdittmar
28th June 2012, 10:59
Hi,

My date domain is tfgld.date. I want to subtract 1 month from the current date. When I try to use utc.add() function it doesn’t work.

when i try to use date.to.utc() to convert date into utc date format.

long date.to.utc (long year no, long month no, long month_day no, long hours, long minutes, long seconds)

for this i need to bifurcate my date. sprintf$ function also need utc date format.

please help me what should i do.

Hello,

convert tfgld.date to utc by using sprintf$ , substract 1 from month (what's with year change ?) and convert back.

Regards

yogesh kapil
28th June 2012, 11:09
Hi, thanks for your reply

// invd.l.f = 16-5-2012

long year, week1, month


year = val(sprintf$("%u(%04Y)",invd.l.f))
week1 = val(sprintf$("%u(%02W)",invd.l.f))
month = val(sprintf$("%u(%02m)",invd.l.f))

message("year %d", year)

but message display year = 1970

mark_h
28th June 2012, 13:37
Found this if it helps - UTC dates and 1970 (http://www.baanboard.com/baanboard/showthread.php?t=14508&highlight=year+1970). Is the tfgld date really a utc date?

vahdani
28th June 2012, 16:30
Hi yogesh,

the %u format in sprintf$() is for UTC dates only. For local (not UTC) dates you have to use sprintf$("%D(...)",..) format. See sprintf$() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_formatting_io_sprintf)

You can also use the num.to.date() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_date_time_zones_num_to_date) function as follows:

long year, month, day

num.to.date(invd.l.f, year, month, day)
message("year %d", year)