研究了很久,还是没办法,只有请各路高手相助!
股票5分钟时间数据转换,已知数据如下:63 1A 79 7D 转为时间是--->09030935(月日时分)
68 1A 79 7D --->09030940
6D 1A 79 7D --->09030945
可以看出:7D是09月,79是03日,1A是09时,63、68、6D分别是35、40、45分钟
请教高手要如何转换为正确的月日时分格式呢? --------------------编程问答-------------------- 数据不足以进行完全的判断,姑且假定给定值为从某个时间点开始的秒数:
dim BaseTime as DateTime = new DateTime(1940,12,18,22,54,39)
Console.WriteLine("{0}", BaseTime.AddSeconds(&H7d791a63))
Console.WriteLine("{0}", BaseTime.AddSeconds(&H7d791a68))
Console.WriteLine("{0}", BaseTime.AddSeconds(&h7d791a6d))
--------------------编程问答-------------------- 具体月日时分如何转换的协议未定,可以假定对于月日时分分别的初始值相同,即月、日、时、分连续。
Module Module1
Private m_imonth As Integer
Private m_iday As Integer
Private m_ihour As Integer
Private m_iminute As Integer
Private Sub MyDateTime()
Dim month As Integer = &H7D
Dim day As Integer = &H79
Dim hour As Integer = &H1A
Dim minute As Integer = &H65
Try
m_imonth = CInt(month - &H7D) + 9
m_iday = CInt(day - &H79) + 3
m_ihour = CInt(hour - &H1A) + 9
m_iminute = CInt(minute - &H63) + 35
If m_imonth > 12 Or m_iday > 31 Or m_ihour > 12 Or m_iminute > 60 Then
Console.WriteLine("Input wrong number!")
End If
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
End Sub
Sub Main()
Call MyDateTime()
Console.WriteLine(m_imonth & "月" & m_iday & "日" & m_ihour & "时" & m_iminute & "分")
Console.ReadLine()
End Sub
End Module --------------------编程问答-------------------- 上面那个month/day/hour/minute我输入了一个数据测试 --------------------编程问答-------------------- 多谢hixiaosheng!
我会找多点数据测试测试,感觉分钟有点问题.还是很多谢你. --------------------编程问答-------------------- 路过
我的网站指点一下http://www.bework.com.cn
--------------------编程问答-------------------- 这种一般都是距离一个指定的时间点的秒数(yyyy-MM-dd HH:mm:ss)
要找出这个时间点,然后加上你的那个数(按秒加),就可以得到正确的时间点
--------------------编程问答-------------------- 刚算了一个,那个初始时间点应该是1940-12-18 22:44:49 --------------------编程问答-------------------- 请问lz,股票的数据是怎么搞到的? --------------------编程问答-------------------- 可以用WPE来截获啊,这个难度不大,主要还是分析不太好分析,给你一段,看看能分析不
17 59.41.59.142:10206 192.168.1.122:1163 14 接收
0000 49 63 65 50 01 00 01 00 01 00 44 01 00 00 IceP......D...
18 59.41.59.142:10206 192.168.1.122:1163 310 接收
0000 01 00 00 00 08 61 32 31 32 37 35 35 39 14 5D 42 .....a2127559.]B
0010 78 64 3C 37 2F 64 6A 7B 2E 5E 45 77 4E 30 2B 64 xd<7/dj{.^EwN0+d
0020 4D 74 00 0A 55 70 64 61 74 65 54 69 63 6B 00 00 Mt..UpdateTick..
0030 06 01 00 00 01 00 01 01 05 79 30 38 30 35 01 01 .........y0805..
0040 05 79 30 38 30 35 31 53 5D E7 17 01 00 00 00 00 .y08051S].......
0050 00 00 00 00 00 00 00 00 00 00 00 8A C5 40 00 00 .............@..
0060 00 00 00 9F C5 40 00 00 00 00 00 E0 C5 40 00 00 .....@.......@..
0070 00 00 00 1D C6 40 00 00 00 00 00 1C C6 40 00 00 .....@.......@..
0080 00 00 00 00 2E 40 00 00 00 00 00 1D C6 40 00 00 .....@.......@..
0090 00 00 00 00 10 40 00 00 00 00 00 1E C6 40 00 00 .....@.......@..
00A0 00 00 00 D2 C5 40 00 00 00 00 80 EB F1 40 00 00 .....@.......@..
00B0 00 00 30 08 00 41 00 00 00 00 80 C1 00 41 00 00 ..0..A.......A..
00C0 00 00 00 F3 C5 40 00 00 00 00 00 00 45 40 00 00 .....@......E@..
00D0 00 A1 90 77 ED 41 00 00 00 00 00 00 00 00 00 00 ...w.A..........
00E0 00 00 00 00 00 00 00 00 00 00 00 E1 C5 40 00 00 .............@..
00F0 00 00 00 58 BD 40 00 00 00 00 00 66 C6 40 00 00 ...X.@.....f.@..
0100 00 00 00 AE C4 40 00 00 00 00 80 B8 E2 40 00 00 .....@.......@..
0110 00 00 80 1E E1 40 00 00 00 00 E0 78 E0 40 00 00 .....@.....x.@..
0120 00 00 20 5E E3 40 00 00 00 00 00 00 00 C0 00 00 .. ^.@..........
0130 00 00 00 00 00 00 ......
19 59.41.59.142:10206 192.168.1.122:1163 14 接收
0000 49 63 65 50 01 00 01 00 01 00 46 01 00 00 IceP......F...
20 59.41.59.142:10206 192.168.1.122:1163 312 接收
0000 01 00 00 00 08 61 32 31 32 37 35 35 39 14 5D 42 .....a2127559.]B
0010 78 64 3C 37 2F 64 6A 7B 2E 5E 45 77 4E 30 2B 64 xd<7/dj{.^EwN0+d
0020 4D 74 00 0A 55 70 64 61 74 65 54 69 63 6B 00 00 Mt..UpdateTick..
0030 08 01 00 00 01 00 01 00 06 61 75 30 38 30 36 01 .........au0806.
0040 00 06 61 75 30 38 30 36 6F 53 5D E7 17 01 00 00 ..au0806oS].....
0050 00 00 00 00 00 00 00 00 67 66 66 66 66 F6 6A 40 ........gffff.j@
0060 33 33 33 33 33 F3 6A 40 00 00 00 00 00 F0 6A 40 33333.j@......j@
0070 5C 8F C2 F5 28 E4 6A 40 33 33 33 33 33 E3 6A 40 \...(.j@33333.j@
0080 00 00 00 00 00 00 F0 3F 3E 0A D7 A3 70 E5 6A 40 .......?>...p.j@
0090 00 00 00 00 00 00 F0 3F C3 F5 28 5C 8F F2 6A 40 .......?..(\..j@
00A0 67 66 66 66 66 D6 6A 40 00 00 00 00 00 14 BE 40 gffff.j@.......@
00B0 00 00 00 00 00 88 DF 40 00 00 00 00 00 42 E0 40 .......@.....B.@
00C0 33 33 33 33 33 E3 6A 40 00 00 00 00 00 00 18 40 33333.j@.......@
00D0 9A 99 99 39 5F 97 6F 41 00 00 00 00 00 00 00 00 ...9_.oA........
00E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00F0 00 00 00 00 00 00 00 00 90 C2 F5 28 5C 4F 6C 40 ...........(\Ol@
0100 85 EB 51 B8 1E 9D 69 40 00 00 00 00 00 27 B0 40 ..Q...i@.....'.@
0110 00 00 00 00 00 DA AB 40 00 00 00 00 00 24 AA 40 .......@.....$.@
0120 00 00 00 00 00 02 B1 40 00 20 85 EB 51 B8 9E 3F .......@. ..Q..?
0130 00 00 00 00 00 00 00 00 ........
21 59.41.59.142:10206 192.168.1.122:1163 14 接收
0000 49 63 65 50 01 00 01 00 01 00 46 01 00 00 IceP......F...
22 59.41.59.142:10206 192.168.1.122:1163 312 接收
0000 01 00 00 00 08 61 32 31 32 37 35 35 39 14 5D 42 .....a2127559.]B
0010 78 64 3C 37 2F 64 6A 7B 2E 5E 45 77 4E 30 2B 64 xd<7/dj{.^EwN0+d
0020 4D 74 00 0A 55 70 64 61 74 65 54 69 63 6B 00 00 Mt..UpdateTick..
0030 08 01 00 00 01 00 01 00 06 63 75 30 38 30 34 01 .........cu0804.
0040 00 06 63 75 30 38 30 34 EC 53 5D E7 17 01 00 00 ..cu0804.S].....
0050 00 00 00 00 00 00 00 00 00 00 00 00 C0 21 EE 40 .............!.@
0060 00 00 00 00 80 52 EE 40 00 00 00 00 00 50 EE 40 .....R.@.....P.@
0070 00 00 00 00 40 3D EE 40 00 00 00 00 40 3D EE 40 ....@=.@....@=.@
0080 00 00 00 00 00 00 18 40 00 00 00 00 80 3E EE 40 .......@.....>.@
0090 00 00 00 00 00 00 08 40 00 00 00 00 40 6A EE 40 .......@....@j.@
00A0 00 00 00 00 00 2D EE 40 00 00 00 00 80 6B DD 40 .....-.@.....k.@
00B0 00 00 00 00 A0 EF F4 40 00 00 00 00 60 7F F5 40 .......@....`..@
00C0 00 00 00 00 C0 41 EE 40 00 00 00 00 00 00 18 40 .....A.@.......@
00D0 00 00 00 16 74 2C C6 41 00 00 00 00 00 00 00 00 ....t,.A........
00E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00F0 00 00 00 00 00 00 00 00 00 00 00 00 40 55 EF 40 ............@U.@
0100 00 00 00 00 00 ED EC 40 00 00 00 00 80 B3 CE 40 .......@.......@
0110 00 00 00 00 80 23 CC 40 00 00 00 00 80 2C CB 40 .....#.@.....,.@
0120 00 00 00 00 80 AA CF 40 00 00 00 00 00 00 00 00 .......@........
0130 00 00 00 00 00 00 00 00 ........
23 59.41.59.142:10206 192.168.1.122:1163 14 接收
0000 49 63 65 50 01 00 01 00 01 00 46 01 00 00 IceP......F...
24 59.41.59.142:10206 192.168.1.122:1163 312 接收
0000 01 00 00 00 08 61 32 31 32 37 35 35 39 14 5D 42 .....a2127559.]B
0010 78 64 3C 37 2F 64 6A 7B 2E 5E 45 77 4E 30 2B 64 xd<7/dj{.^EwN0+d
0020 4D 74 00 0A 55 70 64 61 74 65 54 69 63 6B 00 00 Mt..UpdateTick..
0030 08 01 00 00 01 00 01 00 06 7A 6E 30 38 30 34 01 .........zn0804.
0040 00 06 7A 6E 30 38 30 34 EC 53 5D E7 17 01 00 00 ..zn0804.S].....
0050 00 00 00 00 00 00 00 00 00 00 00 00 80 61 D4 40 .............a.@
0060 00 00 00 00 40 C4 D4 40 00 00 00 00 C0 B2 D4 40 ....@..@.......@
0070 00 00 00 00 40 47 D4 40 00 00 00 00 40 47 D4 40 ....@G.@....@G.@
0080 00 00 00 00 00 00 F0 3F 00 00 00 00 80 48 D4 40 .......?.....H.@
0090 00 00 00 00 00 00 26 40 00 00 00 00 00 C3 D4 40 ......&@.......@
00A0 00 00 00 00 00 32 D4 40 00 00 00 00 40 C0 01 41 .....2.@....@..A
00B0 00 00 00 00 00 87 F2 40 00 00 00 00 C0 5C F3 40 .......@.....\.@
00C0 00 00 00 00 00 61 D4 40 00 00 00 00 00 00 00 40 .....a.@.......@
00D0 00 00 C0 6E B8 0B E1 41 00 00 00 00 00 00 00 00 ...n...A........
00E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00F0 00 00 00 00 00 00 00 00 00 00 00 00 00 31 D5 40 .............1.@
0100 00 00 00 00 C0 90 D3 40 00 00 00 00 30 62 F1 40 .......@....0b.@
0110 00 00 00 00 50 1E F2 40 00 00 00 00 60 55 F1 40 ....P..@....`U.@
0120 00 00 00 00 20 2B F2 40 00 00 00 00 00 00 00 00 .... +.@........
0130 00 00 00 00 00 00 00 00 ........
这个基本还属于明码呢,俺也分析不了,有点菜啊,大家帮忙看看啊
--------------------编程问答-------------------- 刚算了一个,那个初始时间点应该是1940-12-18 22:44:49
-------------
错的...这个绝对不是以秒为最小单位的...是按分钟...而且没有年份数据...
这是一种自定义的格式...应该是某种很简单的算法...但是需要更多不同月份的样本来分析...
补充:.NET技术 , VB.NET