cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Convert string (time string ) to time format

Former Member
0 Likes
771

Hi,

In this line of code

oUserTable.UserFields.Fields.Item("U_SBTime").Value = oDBs_Detail.GetValue("U_SBTime", i)

i am assigning value to user table field of datetime,but it is taking always 12:00 why?

here ia m updating table so, 0:00 is storing in tables

Here iam giving time not date(eg break time ,lunch time)

i entered 12:35 , 11:45

next i want to update this timings like

this

oUserTable.UserFields.Fields.Item("U_SRTime").Value = oDBs_Detail.GetValue("U_SRTime", i)

here i am getting the problem

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi Uday,

Use this method.Problem is solved.

Public Shared Function GetEditTime(ByVal DateValue As String) As String

If DateValue.Length = 1 Then

Return DateValue & ":00"

ElseIf DateValue.Length = 2 Then

Return DateValue & ":00"

ElseIf DateValue.Length = 3 Then

DateValue = DateValue.Substring(0, 1) & ":" & DateValue.Substring(1, 2)

Return DateValue

ElseIf DateValue.Length = 4 Then

DateValue = DateValue.Substring(0, 2) & ":" & DateValue.Substring(2, 2)

Return DateValue

End If

Return "00:00"

End Function

Answers (1)

Answers (1)

Former Member
0 Likes

HI,

Di you defined your User defined field at the table as Date and subtype as time?

For me Working well in PL49 B12007


oudf.Type = BoFieldTypes.db_Date 
oudf.SubType = BoFldSubTypes.st_Time 

Regards,

J.