How to change the time value
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.
This will set "s" to "123456" if the time is currently 12:34:56 PM:
Dim s as String
s = Format( Time(), "HHmmss" )
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
DateTime.Now.ToString("HHmmss")
will do
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
精彩评论