*DATETIME

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

*DATETIME

Post by soa »

I have a variable

Define Field(#dtavl) Type(*DATETIME) Length(19)

I want to set the date and time portions

This sets the date

#dtavl := #CATGRPCL.AsDate( CCYYMMDD )

but this sets the time and but turns the date back to 1900-01-02

#dtavl := #WRK6N0.AsTime( HHMMSS )

How do I set both parts?

I want to build two datetimes so I can compare them without spanning midnight etcetera

Cheers
Jim
MarkD
Posts: 692
Joined: Wed Dec 02, 2015 9:56 am

Re: *DATETIME

Post by MarkD »

You haven't said what type CATGRPCL and WRK6N0 are, but hazarding a guess, this seems to work:

Code: Select all

Define Field(#dtavl) Type(*DATETIME) Length(19)
Define Field(#CATGRPCL) Type(*CHAR) Length(8) Default('20190920')
Define Field(#WRK6N0) Type(*CHAR) Length(6) Default('131415')
Define Field(#YYYYMMDDHHMMSS) Type(*CHAR) Length(14)

#YYYYMMDDHHMMSS := #CATGRPCL + #WRK6N0

#dtavl := #YYYYMMDDHHMMSS.AsDateTime( CCYYMMDDHHMMSS )

#Sys_web.Alert Caption(#dtavl.AsDisplayString)
soa
Posts: 339
Joined: Mon Dec 07, 2015 3:15 pm

Re: *DATETIME

Post by soa »

Looks good,
thanks Mark
Post Reply