Re: dateTime Manupulations

From: Cor Ligthert (notmyfirstname_at_planet.nl)
Date: 10/20/04


Date: Wed, 20 Oct 2004 19:03:48 +0200

Jay,

Your message shows only that you completly did not read my message or
completly do not understand what is the situation where it is in real
business needed to convert a datetimestring to another culture.

In none of the threads I have read explicitly that there was needed a
datetime conversion between strings, however it was a datetime conversion
between a datetime value and a string value.

So show me first where that culture conversion is needed before you start to
tell that for conversion between a string and a date a CDate is not the best
choise.

Cor

"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com>
> Cor,
> It seems to me you have the blinders on a just a little too tight. :-|
>
> In other words you are only seeing CDate, where as you might want to look
> to the side & see DateTime.ParseExact also!
>
> I agree using the VB Convert Functions in most cases is the way to go.
> However like any rule there are exceptions. As has been demonstrated,
> converting a DateTime with a specific format is one of those exceptions.
>
> An analogy might be a Carpenter. Does a (good) carpenter have a single
> hammer? No, they have 2 or 3 kinds of hammers, as each is needed depending
> on what he is doing. Does he have a single screwdriver? No, he has
> standard (or slotted) and Phillips, plus possible a whole slew of others.
> Does he have a single size of screwdriver? No he has #0 thru #4 sizes
> based on the requirements of the specific job.
>
> The Carpenter has different tools & sizes & shapes of the "same" tool, as
> each is required for a specific job. Same with CDate &
> DateTime.ParseExact. Most of the time CDate (a #2 slotted screwdriver) is
> fine, however sometimes you need a specialized tool, such as
> DateTime.ParseExact (a #0 slotted screwdriver).
>
> For the life of me, I really don't understand why you don't see this.
> Reading Reny & z.'s earlier question both stated, in a specific format,
> which to a number of developers myself included, suggests that
> DateTime.ParseExact with a specific format string is the correct method in
> this instance.
>
> I hope you realize I am not saying don't use CDate, as I use it where
> CDate makes sense.
>
> What I am saying is that CDate does not make sense in this case. For some
> reason you are not accepting this, from Herfried, Jon, myself or others. I
> really don't know why, or how we can better explain it.
>
> In closing, I sincerely hope you will take the time & reread both of these
> threads and make a concerted effort to understand why a number of us may
> be saying that in these two specific cases using DateTime.ParseExact might
> be better then relying solely on CDate. Hopefully you will realize that
> the blinders are just a little too tight.
>
> Hope this helps
> Jay
>
>
> "Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
> news:%23iM$thrtEHA.3564@tk2msftngp13.phx.gbl...
>> Jay,
>>
>> I just following the advice from the VBNet pages to use the Convert
>> Functions from which I understand it is advices to use them because they
>> give the best overall performance.
>>
>> Although when those advices were not given do I find them very clear to
>> use and easy. I find them one of the best extra parts of VBNet.
>>
>> Because of all that doing, from Herfried and others who say that when
>> someone who asks how to set a date and time, and than gives with that a
>> format string, particulary wants to use change a format not in his own
>> local format I give now that other situation.
>>
>> In my opinion are those datestring information more given as extra
>> information for us (what format the OP is using) than that he directly
>> wants to convert the format. I did not by accident give the Australian
>> format when I saw the time of the message. However that was a gues.
>>
>> Beside that can I only think of one situation where it is needed to
>> change the dateandtime given in a culture and that is with a webformpage
>> or with any other document where that is in.
>>
>> Than it is better in my opinion to set in the class that processes that
>> first the right language/culture and set that back at the end of the
>> class. Doing that for every instruction inside will give in my idea more
>> dangerous code when there is maintanance.
>>
>> That has nothing to do with understanding. Sometimes I get the idea that
>> you think that I write things because of lack of knowledge.
>>
>> For me are rules as 80/20 and "keep it simple" very important. A program
>> have to be made however mostly as well will there be maintenance on it.
>>
>> I hope that you can share my opinion above and understand why I am
>> telling this about globalization.
>>
>> Cor
>>
>>
> <<snip>>
>



Relevant Pages

  • Proposal: String::Format::General
    ... It provides format string parsing and output assembly, you provide the code that implements the individual conversion characters. ... Format syntax is kind of a cross between sprintf and strftime, but how close it is to each of these depends on the semantics implemented by the user. ... Note that the following is pre-alpha documentation; the interface to the output conversion code has changed since yesterday, ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)
  • Proposal: String::Format::General
    ... It's almost a meta-formatter with the user providing individual conversion code behind a sprintf/strftime-like interface. ... A format is basically a string into which data are to be inserted. ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)
  • Re: Proposal: String::Format::General
    ... It's almost a meta-formatter with the user providing individual conversion code behind a sprintf/strftime-like interface. ... A format is basically a string into which data are to be inserted. ... conversion character, and contain a number of optional fields which may ...
    (comp.lang.perl.modules)
  • Re: dateTime Manupulations
    ... Notice the quoted string, a specific format for a date & time. ... will need to convert that string into a DateTime. ... > datetime conversion between strings, however it was a datetime conversion ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Excel VBA vs Time fields
    ... CDate can convert times entered as strings if they are in the correct format ... with the colon and the string contains hours. ... and cannot handle hours exceeding 24. ...
    (microsoft.public.excel.programming)