Reputation: 11982
Using VB6
In my Form am using DateTime Picker for Time.
DateTimePickerValue = 13:00:00
From the DateTimePicker i need to get 130000 instead of 13:00:00, How to avoid the ':'
Tried Code
Dim dpv As String
dpv = Left(dpin, 2) & Mid(dpin, 4, 2) & Right(dpin, 2)
MsgBox dpv
dtpin is datetimepickerforat dtpin format = custom Format (HH:mm:ss)
dtpin = "08:00:00" (Selected Values form the datetime picker)
Output displaying: 1222Am
(MMDD displaying)
I need Timeonly 080000
How to get this.
Upvotes: 0
Views: 1363
Reputation: 3039
This will set "s" to "123456" if the time is currently 12:34:56 PM:
Dim s as String
s = Format( Time(), "HHmmss" )
Upvotes: 1
Reputation: 1
I'm not that familiar with VB6 but I know it can use Regex. Regex will let you use a regular expression to find and replace the colon which sounds like what your going for. Here a link if your new to regular expressions.
http://www.funduc.com/regexp.htm
Upvotes: 0
Reputation: 61046
Not sure if I understand.
Try
Sub a()
dpv = "13:00:00"
dp = Left(dpv, 2) & Mid(dpv, 4, 2) & Right(dpv, 2)
MsgBox dp
End Sub
Upvotes: 0