Convert Type Long To Date
Hello everyone,
Please tell me how can I convert a type long ("20031217180537011") into datetime format!
Thank you in advance! Best regards
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert Long Date To Short Date
Hi all,
How to convert long date format to short date format.
Ex:
Text1.Text = FormatDateTime(Date, vbLongDate)
Text2.Text = FormatDateTime(Text1.text, vbShortDate) ' here i am getting type mismatch error
i am getting type mismatch error eventhough i used CDate function to convert expression to date.
Edited by - Lokesh_c on 5/17/2004 1:43:45 AM
Convert Long Into Date
Hello everyone,
Please can you help me?
I must convert variant data types to DATE from long. But i don't know how!
I wish to convert from "1075720276235" into date format.
Long represent time from Christ until now!
Thank you in advance!
Best regards
Convert Long To Date
I'm looking at someone elses code that generates keys using dates.
part of his code converts a date type to a long
Clng(Date)
Is there a way to reverse this? that is convert the long back to a date?
Convert Text Type To Date Type In Ms Access
i've dates stored as Text data type in a field of a table in ms access. i want to retreive the data between the specific dates.
any one out there pls suggest me how the above can be achieved.
harish.
Convert Date In REG_BINARY Form To Date Type
Hi!
I wanted to convert a value out of the registry to a date/time and was wondering if someone could help me out.
I'm trying to detect the last time a user performed a virus check on their machine. Norton stores the last scan date in the registry as a REG_BINARY type. Currently, in the registry it has the value "D2 07 02 00 04 00 07 00 14 00 3B 00 27 00 4E 03." I was able to retrieve it from the registry into a byte array with the value: "2107204070200590390783." It's the same value you'd get if you convert each of the hex numbers to decimal.
At this point, I'm not sure how to convert this value into a Date/time. I'm not sure if this is in a SYSTEMTIME structure, but for each key (last scan date and virus definitions date), Norton has labelled it "SystemTime."
will really appreciate any leads I could get!
Thanks!
AA
Convert Long Data Type To Integer Data Type
I am trying to convert an array from a long data type to an integer data type. When I use the Cint() function I am getting an overflow error. Is there a way around this? Basically what I am trying to do is to convert two successive 16 bit representations (stored as a long) number into a floating point using the MoveMemory API. The .ReadResults is an OCX defined function that reads MyLongData(j) from Memory and stores into a long data type.
Code:
Dim MyIntData(2) As Integer
Dim MyLongData(2) As Long
Dim fValue As Single
Dim j As Integer
For j = 0 To 1
MyStatus = MbMasterV71.ReadResults(hConnect, Slave, Cmd, RegStart + j, MyLongData(j))
Next j
MyIntData(0) = CInt(MyLongData(0))
CopyMemory fValue, MyIntData(0), 4
Convert An RGB Value To A Long, Or A Long To RGB
I thought that this might be helpful to someone...
VB Code:
'Convert RGB to LONG: LONG = B * 65536 + G * 256 + R 'Convert LONG to RGB: B = LONG 65536 G = (LONG - B * 65536) 256 R = LONG - B * 65536 - G * 256
Cheers...
Convert Lat/Long To UTM
First off apologies if this doesn't belong here (as I kind of suspect it doesnt). I am coming here as a last resort because I can't seem to find a sensible response anywhere else.
I have a set of coordinates in decimal degrees format. I have converted this into degrees format e.g.
5237.1642N,00108.5366W in decimal degrees becomes
52°37"10'N,001°08"33' degrees.
I am not sure if this is correct but I sorely hope so because nothing else seems to be going right!
So I now have a column with each of these values in, and I need to convert them to UTM format (Eastings / Northings). Nothing I have found can help me do this without a seriously deep understanding of trig! Do any of you know how I can do this conversion in excel, or know of a resource that could help me on my way?
Pleaaaaaaase!
Massive thanks in advance for any help!
~Shiv
Convert Hex$ Into Long
I want to do the reverse of the Hex$() function, that is I have a hex string in a grid and I want to convert it back into a long for processing. Is there a function to do this or do I have to fill a byte array?
-K
Convert String To Long
Hi i'am new at Basic, and i've searched all over and i can't find a way to convert a String Var to Long Var. Any help?
Thanks
How Can I Convert An IP Address To A Long Value?
In PHP its a simple ip2long($ip) function..
After searching google and these forums for a similar function in VB, I came up with this:
VB Code:
Private Type myBytes B1 As Byte B2 As Byte B3 As Byte B4 As ByteEnd Type Private Type myLong Val As LongEnd TypePublic Function IP2Long(ByVal ip As String) As Long ReDim parse(0 To 3) As String Dim B As myBytes Dim L As myLong parse = Split(ip, ".") B.B1 = Val(parse(0)) B.B2 = Val(parse(1)) B.B3 = Val(parse(2)) B.B4 = Val(parse(3)) LSet L = B IP2Long = L.ValEnd Function
This functions returns -1158131642 for the IP '70.80.248.186' (incorrect), whereas php returns 1179711674 (correct)
Any idea why this is?
Trying To Convert Long To String
Thanks alot for the recent helps, but I just have one more question. When I try to convert long to string, all of the 0 disappear and also everything after it. Like the code below the byt(7) does not appear. Please help.
Dim byt(1 To 7) As String
Dim str As String
byt(1) = &HC6
byt(2) = &H86
byt(3) = &H8C
byt(4) = &H0
byt(5) = &H0
byt(6) = &H0
byt(7) = &H1
For i = 1 To 7
str = str & Chr(byt(i))
Next
How Can I Convert A String Into A Long?
Hi,
I got a string, that I load from a INI, but it's a number, I want it to be a long, because I need to put it into a function that only accept Longs... here is my code:
VB Code:
Private Type MapConfigType Name As String Width As String Height As String PosX As String PosZ As String Quality As String Heightmap As String Texture As StringEnd Type Function GetINI(strSectionHeader As String, strVariableName As String, strFileName As String) As String Dim strReturn As String strReturn = String(255, Chr(0)) GetINI = Left$(strReturn, GetPrivateProfileString(strSectionHeader, ByVal strVariableName, "", strReturn, Len(strReturn), strFileName))End Function Public Sub LoadMap(sFilename As String) MapConfig.Name = GetINI("Settings", "Name", sFilename) MapConfig.Width = GetINI("Settings", "Width", sFilename) MapConfig.Height = GetINI("Settings", "Height", sFilename) MapConfig.PosX = GetINI("Settings", "PosX", sFilename) MapConfig.PosZ = GetINI("Settings", "PosZ", sFilename) MapConfig.Quality = GetINI("Settings", "Quality", sFilename) MapConfig.Heightmap = GetINI("Settings", "Heightmap", sFilename) MapConfig.Texture = GetINI("Settings", "Texture", sFilename) Land.GenerateHugeTerrain App.Path & "" & MapConfig.Heightmap, MapConfig.Quality, MapConfig.Width, MapConfig.Height, MapConfig.PosX, MapConfig.PosZ End Sub
The error is at Land.GenerateHugeTerrain since Width, height, etc needs to be a Long.
Can someone help me on this one?
Convert String To Long Not Int
this is a sample string "1312098" how do i convert it to LONG
i know:
cint = str to int
str = int to str
but i need str to long
Convert Long To Big Endian
I want to convert a long integer to its four character string big endian representation .
Any help on this ?
Convert IP-address To Long Int
How do I convert an Ip-address into a long integer? A collegeau of mine told me that an IP is nothing more than an long integer.
Thanks,
Sand Hawk
How To Convert Long To Hexadecimal Value?
I need to convert a long value into hex and then back to long when i retrive the value
The reason is I am storing a certian value in the registy as a dword type entry
Thanks
Convert Long Into Three 8 Bit Words
I have a long variable from 0 to 5940,000 and I what to convert it into 3 byte, 8 bits long.
I dont get the proper numbers when I 5940000 / 65536 to get the high byte ?
Jerry
Convert Long Word
This is pretty basic I think... I'm looking at a tiff file in a hex viewer I know that bytes 4-7 give me an offset to some other info in the file I want to view - question: How do I convert the 4 bytes into a decimal number so I know what offset to seek to?
In this case the bytes are: 82 04 00 00
Thanks for your help.
How To Convert An Array Of Long To A Bitmap?
The problem emerges from the GetCurrentImage function in Directshow.
I use the example vbdemo from the DX8.1 SDK (DXSDKMultimediaVBSamplesDirectShowVBDemo). If the graph is paused ( Call m_objMediaControl.Pause) you may capture the current video frame with the following code:
Code:
Dim mylong as Long, mylong2 As Long, myWidth As Long, myHeight As Long
Dim myimage() As Long
myHeight = m_objBasicVideo.VideoHeight
myWidth = m_objBasicVideo.VideoWidth
mylong = (myHeight * myWidth + 10)
mylong2 = mylong * 4
ReDim myimage(mylong - 1)
Call m_objBasicVideo.GetCurrentImage(mylong2, myimage(0))
What you get back is an array with a 40 byte DIB header and the pixel data in 32 bit. Now I want to put the image to a picturebox. The first thing I tried was to use StretchDIBits. But unfortunately this gives a 'distorted' image (wrong colors and geometry). To 'learn' more about the image format I have added a BMP header and saved the DIB to disk.
Code:
Dim header(0 To 13) As Byte
header(0) = &H42
header(1) = &H4D
header(10) = &H36
Open "file.dib" For Binary As #1
Put #1, , header
Put #1, , myimage
Close #1
Then I opened the file with irfanview. Same result as with StretchDIBits. Having a closer look to the DIB header, I found out that the biBitCount (color resolution in bits per pixel) was 24 BPP instead of 32 BPP. Therefore I 'patched' the header to 32 BPP:
Code:
myimage(21) = 0
myimage(22) = 0
myimage(24) = &H12
myimage(25) = &HB
myimage(28) = &H12
myimage(29) = &HB
Save the file to disk, open with irfanview -> Perfect!
Load the saved image to a picturebox with LoadPicture -> Perfect!
Using StretchDIBits with the 'patched' DIB -> still wrong
Any ideas how to put the image data to a picturebox without saving it to disk? Maybe with GDI+ ? But I don't have a handle for the bitmap...
P.S. Sorry for the long Post, but I don't know how to describe the problem shorter.
How Do I Convert A Long To A Byte Array?
I generate a checksum from a string
that checksum is stored into a long variable, but I need to convert it into a byte array
VB Code:
dim MyLng as longdim myBytes(3) as byte MyLng = &hFFFFFFFF 'now I need to find out how to assign the long value to the byte array :(
can anyone help?
Convert Short Filenames To Long (please Help!)
Is there any way to do this? The reason i want to do this is, that Im trying to associate my program with mp3 files, but when i double-click an mp3 file in the explorer, my program get its pathway in "short" version i.e "c:goodmu~1music~1.mp3"
And for some reason my program cant find the file, when the pathway is like that.
So please! Can someone help me with a way to convert short filenames / pathways to long?
Added green "resolved" checkmark - Hack
Convert Form.backcolor Value To Long?
Hello. I am trying to use the CreateSolidBrush API to give my form's menu a particular color (in my case I just want to set the menu's color to the form's background color - right now the menu is white).
CreateSolidBrush expects a long value for the color. However, the form's .backcolor value in the properties window is some weird system color value, in this case "&H8000000F&". How do I convert this value to the long value I need for the CreateSolidBrush API? Is there another API call I need to use that retrieves the form's background color as a long value?
BTW I'm using VB6.
Many thanks in advance...
Convert Long To Dword To Bytes
Hello,
lets say I have a long: 345,678
I need VB to convert to a dword: 5464E
Then convert that to bytes: 4E 46 05
How?
Many thanks for any help
- Jake
Convert Long Format [1/2] To Decimal
How do I convert a double number, say 1.25 to a long format number, say 1 [1/4], and vise versa? Is there a function in vb 6 that will do it for me or do I need to write code (and what code would I write)?
Thanks!
Convert String To Long In The Array
Hi
I read data from text file, the text file register as
"00026","BALDO COM. DE MOLAS E ACESSORIOS LTDA.","000022","070501",23.32,6.00,388.75,404.31
I used the variable arr_reg
arr_reg = split(myreg,",")
I have arr_reg(0) = "00026"
arr_reg(1) =","BALDO COM. DE MOLAS E ACESSORIOS LTDA."
etc
and I want do select to look if the register exists, but the fields in the table access are integer long, when I tried use CLNG function in the arr_reg(0) It return me error
How do I convert this in Long ?
thank you in advance
Convert Address (Long) To Readable IP
I remember seeing this function, but I can't find it again... I've gotten this far, but it doesn't return the proper IP - means I'm doing the conversion wrong...
Please help!
Code:
Function GetAsciiIP(nAddress As Long) As String
Dim IP(4) As String, hAddress As String, shexAddress As String
Dim x As Integer, pos As Integer
hAddress = Hex(nAddress)
pos = 1
For x = 1 To 4
IP(x) = CStr(CByte(Mid$(hAddress, pos, 2)))
pos = pos + 2
Next x
GetAsciiIP = Join(IP, ".")
End Function
Thx!
Convert String To Unsigned Int Or Long
Hello out there,
I have the following problem,
I have an ATL dll to which I have to pass parameters.
So I have a textbox where the user gives the value. This can be a value between 0 and 4294967295 ( 0x FFFFFFFF ) These values are too big to be Integer, so in my dll i work with unsigned int.
And now the vb problem:
how can i convert the text value to an unsigned int?
Val (value) returns a double which dosn't work ( i don't know why)
CInt(value) and CLng(value) return values up to max 0x 7FFFFFFF
I know Variant can also have uint and ulong values, but how do I set them?
stefan
Convert Long To Bytes For MSComm.Output
I have a problem with sending Long Integer (32bit) over MSComm to a device that takes only 8-bits at a time. I have large numbers to send over... here is a C code that does it, but don't know how to do it in VB:
u8 cmd4[]= {(u8)((N&0xff0000)>>16),(u8)((N&0xff00)>>8),(u8)(N&0xff)};
cmd=cmd4;
writeDevice(cmd,3);
where N is the Long (32bit), writeDevice is similar to MSComm.Output
Any help greatly appreciated!
Simple Question. How Do I Convert A String To A Long?
Simple question.
How do I convert a string to a long?
The string would be a number greater than 32,000. Currently I am using CINT(string) but that crashes with any value over 32k and I need to use a Long.
I searched MSDN, the forum, and other sites but I couldn't find an answer. Maybe I am just wording my question wrong but I hope you know what I am talking about.
thanks,
Convert Selected Binary Values To Long
I'm trying to parse a binary file and want to know if there is a better way to get the long value of specific bytes. I have lot of sector chunks to parse since my binary file can be up to 1GB.
Examples
... 02 0d 45 00 00 00 01 94 22 a2 83 16 72 3c ...
... 02 0d 45 94 22 a2 83 16 72 3c ...
The ones in red are what I'm concerned about.
Code:
Dim bytes(2047) as bytes
Dim a as long
Dim b as string
Dim result as long
fnum=freefile
Open File For Binary Access Read As #fnum
Get #fnum, , bytes
For a = 53 To 56
If Len(Hex(bytes(a))) = 1 Then
b = b & "0" & Hex(bytes(a))
Else
b = b & Hex(bytes(a))
End If
Next a
result = clng("&H" & b)
Edited by - cool1 on 1/3/2006 1:49:58 PM
Convert Long To Single For The GetCursorPos Function
Hello
i am using the getcursorpos function to get the correct position
of the mouse.
the problem is it does not seem to show correct position.
the getcursorpos returns a POINTAPI type which has a X as long and Y as long.
I want the X,Y to get converted to Single.
i tried form1.scalex(point.x,vblong,vbsingle)
but it did not work.
instead i used xsingle=15*xlong and it seems to quite work but not 100%.
also how to i convert from twips to single ??
thanks !!
RESOLVED-Convert Long To Single For The GetCursorPos Function
Hello
i am using the getcursorpos function to get the correct position
of the mouse.
the problem is it does not seem to show correct position.
the getcursorpos returns a POINTAPI type which has a X as long and Y as long.
I want the X,Y to get converted to Single.
i tried form1.scalex(point.x,vblong,vbsingle)
but it did not work.
instead i used xsingle=15*xlong and it seems to quite work but not 100%.
also how to i convert from twips to single ??
thanks !!
Long Type To UDT
Hello.
How do I cast a long to a UDT?
the long type value is a return from an API function.
UDT:
Code:
Public Type NewEventData
Result As Long
UserId As Long
UserNum As Long
End Type
I tried using CopyMemory but my app crashes when I use it.
help please.
thanks in advance.
Help To Convert Byte Array To Ieee Float And Long Integer
Hi,
I'm reading bytes from a binary file in blocks of four bytes.
I now need to convert to ieee float and long integer
I have tried defining a variable as single concatenating bytes and converting by loading to a variable defined as a single,
I have also tried using Csng. I'm obviously missing a step
Here are the two blocks of bytes.
236, 81, 248, 64
205, 204, 0, 65
The results should be 7.76 and 8.05 for the float conversions
but how do I get there.
Thanks
Valter
Convert A Screen Scrap Date To Actual Date
I ned to converta date extracted from a screen scrape to an actual date so if the date is less than today it does one section of code if not it does the other. My problem is i have the date but how do i tell my script its a date not text? Thanks in advance....
|