Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Living and working in Australia, our conventional way to represent
dates is dd/mm/yy. I think our American cousins us mm/dd/yy as their default. Is VBA, I get this: MyDate = #13/12/2007# ? Month(mydate) 12 In this instance, VBA interprets the 2nd qualifier as the month (12), possibly because 13 cannot be a month. MyDate = #11/12/2007# ? Month(mydate) 11 In this instance, VBA interprets the 1st qualifier as the month. This is causing me grief because I have an application that reads text files and tries to interpret US style dates. Can anyone give me guidance on the best way to interpret dates? Thanks in advance. Greg |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why not just parse the text string into 3 pieces--then recombine it the way you
want: mydate = dateserial(yearportion, monthportion, dayportion) Maybe you could use a bunch of left's, right's or mid's to extract each piece. Greg Glynn wrote: Living and working in Australia, our conventional way to represent dates is dd/mm/yy. I think our American cousins us mm/dd/yy as their default. Is VBA, I get this: MyDate = #13/12/2007# ? Month(mydate) 12 In this instance, VBA interprets the 2nd qualifier as the month (12), possibly because 13 cannot be a month. MyDate = #11/12/2007# ? Month(mydate) 11 In this instance, VBA interprets the 1st qualifier as the month. This is causing me grief because I have an application that reads text files and tries to interpret US style dates. Can anyone give me guidance on the best way to interpret dates? Thanks in advance. Greg -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just to add to Dave's advice, in VBA if you have a date string/text, it will
be interpreted as a US format if possible (mm/dd/yy). -- Regards, Tom Ogilvy "Greg Glynn" wrote: Living and working in Australia, our conventional way to represent dates is dd/mm/yy. I think our American cousins us mm/dd/yy as their default. Is VBA, I get this: MyDate = #13/12/2007# ? Month(mydate) 12 In this instance, VBA interprets the 2nd qualifier as the month (12), possibly because 13 cannot be a month. MyDate = #11/12/2007# ? Month(mydate) 11 In this instance, VBA interprets the 1st qualifier as the month. This is causing me grief because I have an application that reads text files and tries to interpret US style dates. Can anyone give me guidance on the best way to interpret dates? Thanks in advance. Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Determine and interpret the P-Value | Excel Discussion (Misc queries) | |||
How do I interpret the result of a chitest? | Excel Discussion (Misc queries) | |||
Interpret code | Excel Programming | |||
Why does Excel interpret 2/29 as Feb 1st? | Excel Discussion (Misc queries) | |||
Could some one please help me to interpret the following syntax | Excel Programming |