|
-
Dec 3rd, 2004, 02:10 PM
#1
Thread Starter
Junior Member
How to convert date to string value?
Hi expert,
I have a data field (birthdate) contains a datetime datatype (mm/dd/yyyy), how can I convert to mmdd??
say, the birthday is 8/1/1979 and convert to mmdd
DOB = DS.Tables("AcctInfoTble").Rows(3)("BRTHDATE")
strResult.Insert(12, DOB.PadLeft(37, " "))
---------------------------------------------------------------------------------------------------
Public Function GenerateA(ByRef strEmpID As String)
Dim strResult As New System.Text.StringBuilder
Dim GPConnection As SqlConnection
Dim dr As SqlDataReader
Dim GPDataset As New DataSet
GPConnection = New SqlConnection(".............................................")
Dim GPDataAdapter As New SqlDataAdapter("SELECT LASTNAME,FRSTNAME,BRTHDATE FROM UPR00102 where EmployID=' " + strEmpID + "'", GPConnection)
Dim EfundAcct As String
Dim LName as string
Dim FName as string
Dim DOB as string
GPConnection.Open()
GPDataAdapter.Fill(GPDataset, "AcctInfoTble")
Dim DS As DataSet = New DataSet
LName = DS.Tables("AcctInfoTble").Rows(1).Item("LASTNAME")
FName = DS.Tables("AcctInfoTble").Rows(2)("LASTNAME")
DOB = DS.Tables("AcctInfoTble").Rows(3)("BRTHDATE")
....................
'Position 13 16N First Name
strResult.Insert(12, FName.PadLeft(16, " "))
....................
'Position 37 4A Birthdate
strResult.Insert(12, DOB.PadLeft(37, " "))
GPConnection.Dispose()
Return strResult.ToString
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|