murthymsr said:
hi pankaj,
sorry for using your thread for some clarification on data format.
i refer to the bhav copy of NSE and not PR.ZIP file.
the format of timestamp column is slightly confusing.
as i understand, the column represents
1) the datepart is with the leading zeros suppressed.
2) in the year part, sometimes the century is shown and some other times not shown. ( i couldn't understand the logic though)
3) to ascertain the data format, i viewed the file in windows notepad, wordpad, excel and other non-windows notepads.
i request, pankaj, satya, joy_mitali and others to record their observations on the data format. this will help be to overcome some of the problems presently faced with my stock screener software.
thanks in advance.
murthymsr
Hi Murthy d
Date is always a problem for those who venture to make programme especially in vb6
There are different ways to represent dates > Two major format are european system(dd/mm/yyyy), american system(mm/dd/yyyy).
So if you tell 911 in america it would mean 11 sept but in europe it would mean 9 Nov.
Due to this lack of uniformity processing is a porblem.
So let us see this problem from a different perspective.
Internal processing in vb6 is done in mmddyyyy format
External display is in system locale or user defined format
When you accept the date it will be correctly interpreted if variable is defined as date. For external representation use of Format commad is required.
If external representation is assigned to
string then in conversion process vb will incorrectly interprete the date .
Now nse data is given in dd-mmm-yyyy format. In notepad and word you will see it displayed as given since it will be in text format(string data) In excel it will be represented in your system locale format or user defined format as the variable is date type.
If your system format is ddmmyy leading zero in year will be suppressed. if it is dmyy the leading zeros in date month and year will be suppressed.
options is to check the format of your system or user defined format and then take the string and appropriately format and assign it to date variable which will then correctly interpret it.
API calls for this purpose are
Option Explicit
Public Const DATE_LONGDATE As Long = &H2
Public Const DATE_SHORTDATE As Long = &H1
Public Const LOCALE_SLANGUAGE As Long = &H2 'localized name of language
Public Const LOCALE_SSHORTDATE As Long = &H1F 'short date format string
Public Const LOCALE_SLONGDATE As Long = &H20 'long date format string
Public Declare Function GetThreadLocale Lib "kernel32" () As Long
Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Public Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Public Declare Function GetLocaleInfo Lib "kernel32" _
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cchData As Long) As Long
Public Declare Function EnumDateFormats Lib "kernel32" _
Alias "EnumDateFormatsA" _
(ByVal lpDateFmtEnumProc As Long, _
ByVal Locale As Long, _
ByVal dwFlags As Long) As Long
Hope this will help you
Pankaj