cancel
Showing results for 
Search instead for 
Did you mean: 

Time value for DateTime UserField

Former Member
0 Kudos

When we save a DateTime value to a UserField of type DateTime using the SAPbobsCOM.UserTable business object, the Time portion is lost (i.e. the Time is always 00:00:00).

When we debug, the DateTime variable we assign to the UserField has the Time value, but the database always ends up with 00:00:00.000 as the Time.

Should we be assigning a String variable to the UserField using a particular format for the Date and Time?

Please advise. Thanks.

View Entire Topic
Former Member
0 Kudos

> When we save a DateTime value to a UserField of type

> DateTime using the SAPbobsCOM.UserTable business

> object, the Time portion is lost (i.e. the Time is

> always 00:00:00).

I made following try without any programming:

I added a UDF with Type "Date/Time" and Structure "Date"

<i>In DI it would be Type=db_Date / SubType=st_None</i>

The GUI does not let me add any other information than a Date (day, month, year).

Now i changed the Structure of my UDF to "Hour"

<i>In DI it would be Type=db_Date / SubType=st_Hour</i>

The GUI now does not let me add any other information than hour and minute.

I don't think it's a very fancy solution, but if it works just as documented (and it does for me), you can't assign a "real" date vale (date, hour, minutes, seconds, millis..) to one date field using the sdk. Maybe they thought it's not easy enough for the user to write date and hour (in correct format) to a single field.

About seconds or milliseconds... I think you do not have that either in the UDF-Hour-type. If you need it in this precision, from my point of view, the user defined fields do not meet your requirements.

In the SDK DI help file there is a table which describes the relations between the SAP Business One application data types and the DI API data types.

Former Member
0 Kudos

Just wanted to follow up on this post:

I cannot understand why the date fields only store the day-month-year and not the seconds and milliseconds.

Subsequently I have to create to user fields (Date) and (Time) for a query that I want to run, whats more, this query will have up to minute where it will be unnaccurate because the Time fields cannot store seconds or milliseconds!

This date behavior seems very bizzare to me, if anyone has an elegant solution I would be very interested in hearing your opinions!

Thanks,

Daniel