changing the date format in vb.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andreas

    #1

    changing the date format in vb.net

    When I copy a vb.net project using date formats from one PC with a windows
    date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I
    get errors.
    How can I change for a while in the project the date format in vb.code (
    not in Windows) and how can I find out which date format the PC Windows is
    using.
    Thanks for any response



  • iwdu15

    #2
    RE: changing the date format in vb.net

    instead of using or changing the date, why not make your own?

    Dim str as String = Now.Day & "/" & Now.Month & "/" & Now.Year

    which gives:

    dd/mm/yy

    --
    -iwdu15

    Comment

    • andreas

      #3
      Re: changing the date format in vb.net

      That don't work
      When i put in dd/mm/yy in my vb/.net program (on the other PC) is thinking
      that is is yy/mm/dd so there is a error
      There is some code for it with the word globalisation but I don't know the
      code
      Thanks any way

      "iwdu15" <jmmgoalsteraty ahoodotcom> wrote in message
      news:17E82E44-F26D-46B8-ABD2-7850C11B061D@mi crosoft.com...[color=blue]
      > instead of using or changing the date, why not make your own?
      >
      > Dim str as String = Now.Day & "/" & Now.Month & "/" & Now.Year
      >
      > which gives:
      >
      > dd/mm/yy
      >
      > --
      > -iwdu15[/color]


      Comment

      • Cor Ligthert [MVP]

        #4
        Re: changing the date format in vb.net

        Andreas,

        Strange, I can assure you that Ken and I exhange programs on regular base.

        He is in the US and I in the EU. We never had any problem with datetime.

        That would be crazy because in datetime there is not in a special culture.
        It is a "long" which holds a counter of 100 nanoseconds ticks that started
        (in Net) at the Christian calendar date 01/01/01 00:00:00. In other systems
        the starting time and way it is done can be different.

        But never try to convert the datetime to string formats with another reasons
        than to show those.

        I hope this helps,

        Cor


        "andreas" <andreas@pandor a.be> schreef in bericht
        news:Od_jg.4822 93$Kh.12205161@ phobos.telenet-ops.be...[color=blue]
        > When I copy a vb.net project using date formats from one PC with a windows
        > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I
        > get errors.
        > How can I change for a while in the project the date format in vb.code (
        > not in Windows) and how can I find out which date format the PC Windows is
        > using.
        > Thanks for any response
        >
        >
        >[/color]


        Comment

        • andreas

          #5
          Re: changing the date format in vb.net

          When the date format is changed in windows (configuration panel) i got a
          error on a different PC and on my own PC the dates with month = 25,13,..
          and so on where not listened.
          It depens likely on the settings mm/dd/yyyy or yyy/mm/dd.
          And that is my question for a solution in vb.net to detect and to change
          these PC settings


          "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
          news:OebkcGEkGH A.4044@TK2MSFTN GP03.phx.gbl...[color=blue]
          > Andreas,
          >
          > Strange, I can assure you that Ken and I exhange programs on regular base.
          >
          > He is in the US and I in the EU. We never had any problem with datetime.
          >
          > That would be crazy because in datetime there is not in a special culture.
          > It is a "long" which holds a counter of 100 nanoseconds ticks that started
          > (in Net) at the Christian calendar date 01/01/01 00:00:00. In other[/color]
          systems[color=blue]
          > the starting time and way it is done can be different.
          >
          > But never try to convert the datetime to string formats with another[/color]
          reasons[color=blue]
          > than to show those.
          >
          > I hope this helps,
          >
          > Cor
          >
          >
          > "andreas" <andreas@pandor a.be> schreef in bericht
          > news:Od_jg.4822 93$Kh.12205161@ phobos.telenet-ops.be...[color=green]
          > > When I copy a vb.net project using date formats from one PC with a[/color][/color]
          windows[color=blue][color=green]
          > > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then[/color][/color]
          I[color=blue][color=green]
          > > get errors.
          > > How can I change for a while in the project the date format in vb.code[/color][/color]
          ([color=blue][color=green]
          > > not in Windows) and how can I find out which date format the PC Windows[/color][/color]
          is[color=blue][color=green]
          > > using.
          > > Thanks for any response
          > >
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: changing the date format in vb.net

            "andreas" <andreas@pandor a.be> schrieb:[color=blue]
            > When I copy a vb.net project using date formats from one PC with a windows
            > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I
            > get errors.
            > How can I change for a while in the project the date format in vb.code (
            > not in Windows) and how can I find out which date format the PC Windows is
            > using.[/color]

            'System.Globali zation.CultureI nfo.CurrentCult ure.DateTimeFor mat'.

            Using a culture-specific date/time format to persist dates is never a good
            idea if data is exchanged between machines which are potentially running
            with different date/time formats. Instead, use
            'CultureInfo.In variantCulture. DateTimeFormat' to format the dates when
            persisting them and use the invariant culture to read the date values later
            on.

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            • Cor Ligthert [MVP]

              #7
              Re: changing the date format in vb.net

              Herfried,

              The invarianculture in case of datetime is associated with the English
              Language where you can have dependend of the culture june 15 and 15 june.

              This makes it possible to do a dataparse.time( date in written words) for
              both culture systems in the English language.

              Dates written in German needs the parameter in that case that it is in the
              German culture, however if that is the local setting than Nothing is more
              than enough (while invariantcultur e will than have the same effect as
              nothing because the culture is already German). The last is probably your
              situation.

              The system does not automaticly recognise that by instance "1/12/2006" is
              one time 12 december and anoter time januari 12 how much time you write
              that it is an invariant culture.

              Cor

              "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
              news:%23rfMmHHk GHA.4776@TK2MSF TNGP05.phx.gbl. ..[color=blue]
              > "andreas" <andreas@pandor a.be> schrieb:[color=green]
              >> When I copy a vb.net project using date formats from one PC with a
              >> windows
              >> date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I
              >> get errors.
              >> How can I change for a while in the project the date format in vb.code (
              >> not in Windows) and how can I find out which date format the PC Windows
              >> is
              >> using.[/color]
              >
              > 'System.Globali zation.CultureI nfo.CurrentCult ure.DateTimeFor mat'.
              >
              > Using a culture-specific date/time format to persist dates is never a good
              > idea if data is exchanged between machines which are potentially running
              > with different date/time formats. Instead, use
              > 'CultureInfo.In variantCulture. DateTimeFormat' to format the dates when
              > persisting them and use the invariant culture to read the date values
              > later on.
              >
              > --
              > M S Herfried K. Wagner
              > M V P <URL:http://dotnet.mvps.org/>
              > V B <URL:http://classicvb.org/petition/>[/color]


              Comment

              • Cor Ligthert [MVP]

                #8
                Re: changing the date format in vb.net

                Andreas,

                Did you set a string to a datetime somewhere?

                By instance a command like
                dim a as date = CDate(25/06/2006)"
                or the same with
                DateTime.parse
                or with
                DateTime.Conver t
                or with
                CType("date",da tetime)

                Cor

                "andreas" <andreas@pandor a.be> schreef in bericht
                news:uFakg.4832 54$t42.12494959 @phobos.telenet-ops.be...[color=blue]
                > When the date format is changed in windows (configuration panel) i got a
                > error on a different PC and on my own PC the dates with month = 25,13,..
                > and so on where not listened.
                > It depens likely on the settings mm/dd/yyyy or yyy/mm/dd.
                > And that is my question for a solution in vb.net to detect and to change
                > these PC settings
                >
                >
                > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
                > news:OebkcGEkGH A.4044@TK2MSFTN GP03.phx.gbl...[color=green]
                >> Andreas,
                >>
                >> Strange, I can assure you that Ken and I exhange programs on regular
                >> base.
                >>
                >> He is in the US and I in the EU. We never had any problem with datetime.
                >>
                >> That would be crazy because in datetime there is not in a special
                >> culture.
                >> It is a "long" which holds a counter of 100 nanoseconds ticks that
                >> started
                >> (in Net) at the Christian calendar date 01/01/01 00:00:00. In other[/color]
                > systems[color=green]
                >> the starting time and way it is done can be different.
                >>
                >> But never try to convert the datetime to string formats with another[/color]
                > reasons[color=green]
                >> than to show those.
                >>
                >> I hope this helps,
                >>
                >> Cor
                >>
                >>
                >> "andreas" <andreas@pandor a.be> schreef in bericht
                >> news:Od_jg.4822 93$Kh.12205161@ phobos.telenet-ops.be...[color=darkred]
                >> > When I copy a vb.net project using date formats from one PC with a[/color][/color]
                > windows[color=green][color=darkred]
                >> > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then[/color][/color]
                > I[color=green][color=darkred]
                >> > get errors.
                >> > How can I change for a while in the project the date format in vb.code[/color][/color]
                > ([color=green][color=darkred]
                >> > not in Windows) and how can I find out which date format the PC Windows[/color][/color]
                > is[color=green][color=darkred]
                >> > using.
                >> > Thanks for any response
                >> >
                >> >
                >> >[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • Herfried K. Wagner [MVP]

                  #9
                  Re: changing the date format in vb.net

                  "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=blue]
                  > The invarianculture in case of datetime is associated with the English
                  > Language where you can have dependend of the culture june 15 and 15 june.[/color]

                  The invariant culture is invariant by definition and it's unique, which
                  means that it doesn't suffer from the problems other cultures suffer from.
                  If June, 15th is persisted using the invariant culture and later read using
                  the invariant culture, it will always result in June, 15th.
                  [color=blue]
                  > This makes it possible to do a dataparse.time( date in written words) for
                  > both culture systems in the English language.[/color]

                  Why would you want to mix up different cultures?
                  'CultureInfo.In variantCulture' has (by definition) as much to do with 'de'
                  as with 'en'. It's simply a separate culture.
                  [color=blue]
                  > Dates written in German needs the parameter in that case that it is in the
                  > German culture, however if that is the local setting than Nothing is more
                  > than enough (while invariantcultur e will than have the same effect as
                  > nothing because the culture is already German).[/color]

                  ?!? 'InvariantCultu re' is a completely independent culture. It has the
                  same semantics on all systems and thus will never be the same as another
                  culture.
                  [color=blue]
                  > The system does not automaticly recognise that by instance "1/12/2006" is
                  > one time 12 december and anoter time januari 12 how much time you write
                  > that it is an invariant culture.[/color]

                  If you have a 'Date' variable representing '#1/12/2006#' (written as VB date
                  literal) and persist it using the invariant culture and later use the
                  invariant culture to read the persisted value the resulting 'Date' object
                  will have the value '#1/12/2006#'. One doesn't have to care about and know
                  the format used to persist the date using the invariant culture. The
                  invariant culture's main purpose is to make exchange of data between
                  different systems running with different culture settings easier by removing
                  any ambiguities potentially caused by different culture settings.

                  --
                  M S Herfried K. Wagner
                  M V P <URL:http://dotnet.mvps.org/>
                  V B <URL:http://classicvb.org/petition/>

                  Comment

                  • Cor Ligthert [MVP]

                    #10
                    Re: changing the date format in vb.net

                    Herfried,

                    What does this text in the description page of DateTime mean for you.

                    Each DateTime member implicitly uses the Gregorian calendar to perform its
                    operation, with the exception of constructors that specify a calendar and
                    methods that implicitly specify a calendar with a parameter derived from
                    IFormatProvider , such as System.Globaliz ation.DateTimeF ormatInfo. Use the
                    System.Globaliz ation.Calendar class to perform date and time operations with
                    a different calendar.
                    *methods* that implicitly specify a calendar etc.

                    The description from the datetime is:
                    The DateTime value type represents dates and times with values ranging from
                    12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) to 11:59:59
                    P.M., December 31, 9999 A.D. (C.E.)

                    Time values are measured in 100-nanosecond units called ticks, and a
                    particular date is the number of ticks since 12:00 midnight, January 1, 1
                    A.D. (C.E.) in the GregorianCalend ar calendar. For example, a ticks value of
                    312413760000000 00L represents the date, Friday, January 01, 0100 12:00:00
                    midnight. A DateTime value is always expressed in the context of an explicit
                    or default calendar.

                    As I read it as you write, than you give me the idea that for you a datetime
                    is stored in the way as in the literals. The dateobject does not have the
                    value '#1/12/2006#' it has just a counter which has a starting point at
                    01/01/00 00:00:00 in our notation in ISO.

                    I could not find any member for a stored DateTimeFormatI nfo inside the
                    DateTime structure

                    Cor



                    "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht
                    news:e220YJIkGH A.4660@TK2MSFTN GP05.phx.gbl...[color=blue]
                    > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=green]
                    >> The invarianculture in case of datetime is associated with the English
                    >> Language where you can have dependend of the culture june 15 and 15 june.[/color]
                    >
                    > The invariant culture is invariant by definition and it's unique, which
                    > means that it doesn't suffer from the problems other cultures suffer from.
                    > If June, 15th is persisted using the invariant culture and later read
                    > using the invariant culture, it will always result in June, 15th.
                    >[color=green]
                    >> This makes it possible to do a dataparse.time( date in written words) for
                    >> both culture systems in the English language.[/color]
                    >
                    > Why would you want to mix up different cultures?
                    > 'CultureInfo.In variantCulture' has (by definition) as much to do with 'de'
                    > as with 'en'. It's simply a separate culture.
                    >[color=green]
                    >> Dates written in German needs the parameter in that case that it is in
                    >> the German culture, however if that is the local setting than Nothing is
                    >> more than enough (while invariantcultur e will than have the same effect
                    >> as nothing because the culture is already German).[/color]
                    >
                    > ?!? 'InvariantCultu re' is a completely independent culture. It has the
                    > same semantics on all systems and thus will never be the same as another
                    > culture.
                    >[color=green]
                    >> The system does not automaticly recognise that by instance "1/12/2006" is
                    >> one time 12 december and anoter time januari 12 how much time you write
                    >> that it is an invariant culture.[/color]
                    >
                    > If you have a 'Date' variable representing '#1/12/2006#' (written as VB
                    > date literal) and persist it using the invariant culture and later use the
                    > invariant culture to read the persisted value the resulting 'Date' object
                    > will have the value '#1/12/2006#'. One doesn't have to care about and
                    > know the format used to persist the date using the invariant culture. The
                    > invariant culture's main purpose is to make exchange of data between
                    > different systems running with different culture settings easier by
                    > removing any ambiguities potentially caused by different culture settings.
                    >
                    > --
                    > M S Herfried K. Wagner
                    > M V P <URL:http://dotnet.mvps.org/>
                    > V B <URL:http://classicvb.org/petition/>[/color]


                    Comment

                    • andreas

                      #11
                      Re: changing the date format in vb.net

                      Yes
                      I have to read a textdate from a textfile into a textbox and I would'n
                      change my textfile.
                      I put it again, I like to change the windows date format with a command in
                      my vb.net program so that I can run my program on any PC.


                      "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
                      news:eq$Pe#HkGH A.1264@TK2MSFTN GP05.phx.gbl...[color=blue]
                      > Andreas,
                      >
                      > Did you set a string to a datetime somewhere?
                      >
                      > By instance a command like
                      > dim a as date = CDate(25/06/2006)"
                      > or the same with
                      > DateTime.parse
                      > or with
                      > DateTime.Conver t
                      > or with
                      > CType("date",da tetime)
                      >
                      > Cor
                      >
                      > "andreas" <andreas@pandor a.be> schreef in bericht
                      > news:uFakg.4832 54$t42.12494959 @phobos.telenet-ops.be...[color=green]
                      > > When the date format is changed in windows (configuration panel) i got a
                      > > error on a different PC and on my own PC the dates with month = 25,13,..
                      > > and so on where not listened.
                      > > It depens likely on the settings mm/dd/yyyy or yyy/mm/dd.
                      > > And that is my question for a solution in vb.net to detect and to change
                      > > these PC settings
                      > >
                      > >
                      > > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
                      > > news:OebkcGEkGH A.4044@TK2MSFTN GP03.phx.gbl...[color=darkred]
                      > >> Andreas,
                      > >>
                      > >> Strange, I can assure you that Ken and I exhange programs on regular
                      > >> base.
                      > >>
                      > >> He is in the US and I in the EU. We never had any problem with[/color][/color][/color]
                      datetime.[color=blue][color=green][color=darkred]
                      > >>
                      > >> That would be crazy because in datetime there is not in a special
                      > >> culture.
                      > >> It is a "long" which holds a counter of 100 nanoseconds ticks that
                      > >> started
                      > >> (in Net) at the Christian calendar date 01/01/01 00:00:00. In other[/color]
                      > > systems[color=darkred]
                      > >> the starting time and way it is done can be different.
                      > >>
                      > >> But never try to convert the datetime to string formats with another[/color]
                      > > reasons[color=darkred]
                      > >> than to show those.
                      > >>
                      > >> I hope this helps,
                      > >>
                      > >> Cor
                      > >>
                      > >>
                      > >> "andreas" <andreas@pandor a.be> schreef in bericht
                      > >> news:Od_jg.4822 93$Kh.12205161@ phobos.telenet-ops.be...
                      > >> > When I copy a vb.net project using date formats from one PC with a[/color]
                      > > windows[color=darkred]
                      > >> > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd[/color][/color][/color]
                      then[color=blue][color=green]
                      > > I[color=darkred]
                      > >> > get errors.
                      > >> > How can I change for a while in the project the date format in[/color][/color][/color]
                      vb.code[color=blue][color=green]
                      > > ([color=darkred]
                      > >> > not in Windows) and how can I find out which date format the PC[/color][/color][/color]
                      Windows[color=blue][color=green]
                      > > is[color=darkred]
                      > >> > using.
                      > >> > Thanks for any response
                      > >> >
                      > >> >
                      > >> >
                      > >>
                      > >>[/color]
                      > >
                      > >[/color]
                      >
                      >[/color]


                      Comment

                      • Herfried K. Wagner [MVP]

                        #12
                        Re: changing the date format in vb.net

                        "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=blue]
                        > I could not find any member for a stored DateTimeFormatI nfo inside the
                        > DateTime structure[/color]

                        Nobody's claiming that. 'DateTime' per-se doesn't have to do anything with
                        a specific culture. Cultures come into the play when formatting the date to
                        persist it, for example.

                        --
                        M S Herfried K. Wagner
                        M V P <URL:http://dotnet.mvps.org/>
                        V B <URL:http://classicvb.org/petition/>

                        Comment

                        • Cor Ligthert [MVP]

                          #13
                          Re: changing the date format in vb.net

                          Andreas,

                          Than you have to know the format how that date is written and use the
                          overloaded command.

                          datetime.parsee xact

                          http://msdn.microsoft.com/library/de...xacttopic1.asp

                          If you are sure that the dates are only in numbers than the last operand can
                          be nothing.

                          Be aware that this is only in the case of by instand textfiles to datetime.

                          In another culture will the user in the UI type the date in the style he is
                          used to, therefore from a textbox a CDate works perfect.

                          I hope this hels,

                          Cor
                          "andreas" <andreas@pandor a.be> schreef in bericht
                          news:Vlhkg.4838 01$Pj5.12470332 @phobos.telenet-ops.be...[color=blue]
                          > Yes
                          > I have to read a textdate from a textfile into a textbox and I would'n
                          > change my textfile.
                          > I put it again, I like to change the windows date format with a command in
                          > my vb.net program so that I can run my program on any PC.
                          >
                          >
                          > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
                          > news:eq$Pe#HkGH A.1264@TK2MSFTN GP05.phx.gbl...[color=green]
                          >> Andreas,
                          >>
                          >> Did you set a string to a datetime somewhere?
                          >>
                          >> By instance a command like
                          >> dim a as date = CDate(25/06/2006)"
                          >> or the same with
                          >> DateTime.parse
                          >> or with
                          >> DateTime.Conver t
                          >> or with
                          >> CType("date",da tetime)
                          >>
                          >> Cor
                          >>
                          >> "andreas" <andreas@pandor a.be> schreef in bericht
                          >> news:uFakg.4832 54$t42.12494959 @phobos.telenet-ops.be...[color=darkred]
                          >> > When the date format is changed in windows (configuration panel) i got
                          >> > a
                          >> > error on a different PC and on my own PC the dates with month =
                          >> > 25,13,..
                          >> > and so on where not listened.
                          >> > It depens likely on the settings mm/dd/yyyy or yyy/mm/dd.
                          >> > And that is my question for a solution in vb.net to detect and to
                          >> > change
                          >> > these PC settings
                          >> >
                          >> >
                          >> > "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
                          >> > news:OebkcGEkGH A.4044@TK2MSFTN GP03.phx.gbl...
                          >> >> Andreas,
                          >> >>
                          >> >> Strange, I can assure you that Ken and I exhange programs on regular
                          >> >> base.
                          >> >>
                          >> >> He is in the US and I in the EU. We never had any problem with[/color][/color]
                          > datetime.[color=green][color=darkred]
                          >> >>
                          >> >> That would be crazy because in datetime there is not in a special
                          >> >> culture.
                          >> >> It is a "long" which holds a counter of 100 nanoseconds ticks that
                          >> >> started
                          >> >> (in Net) at the Christian calendar date 01/01/01 00:00:00. In other
                          >> > systems
                          >> >> the starting time and way it is done can be different.
                          >> >>
                          >> >> But never try to convert the datetime to string formats with another
                          >> > reasons
                          >> >> than to show those.
                          >> >>
                          >> >> I hope this helps,
                          >> >>
                          >> >> Cor
                          >> >>
                          >> >>
                          >> >> "andreas" <andreas@pandor a.be> schreef in bericht
                          >> >> news:Od_jg.4822 93$Kh.12205161@ phobos.telenet-ops.be...
                          >> >> > When I copy a vb.net project using date formats from one PC with a
                          >> > windows
                          >> >> > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd[/color][/color]
                          > then[color=green][color=darkred]
                          >> > I
                          >> >> > get errors.
                          >> >> > How can I change for a while in the project the date format in[/color][/color]
                          > vb.code[color=green][color=darkred]
                          >> > (
                          >> >> > not in Windows) and how can I find out which date format the PC[/color][/color]
                          > Windows[color=green][color=darkred]
                          >> > is
                          >> >> > using.
                          >> >> > Thanks for any response
                          >> >> >
                          >> >> >
                          >> >> >
                          >> >>
                          >> >>
                          >> >
                          >> >[/color]
                          >>
                          >>[/color]
                          >
                          >[/color]


                          Comment

                          • andreas

                            #14
                            Re: changing the date format in vb.net

                            Herfried and Cor,
                            Thanks, it is very interesting but I want ( if possible) a direct answer.

                            When can change in Windows - Control panel the format of the date and it is
                            important for vb.net when reading a date in plain tekst in a textfile
                            When the windows format is f.e. yyyy/mm/dd and the textfile gives in plain
                            tekst 31/12/2005 then I get a error.
                            When I change the windows format in dd/mm/yyyy than the date is reading.
                            Is it possible and how can I :
                            Dedect in VB.net what the setting is in O.S.
                            Change this setting in what I want in vb.net at the beginning of the
                            program.


                            "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
                            news:#rfMmHHkGH A.4776@TK2MSFTN GP05.phx.gbl...[color=blue]
                            > "andreas" <andreas@pandor a.be> schrieb:[color=green]
                            > > When I copy a vb.net project using date formats from one PC with a[/color][/color]
                            windows[color=blue][color=green]
                            > > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then[/color][/color]
                            I[color=blue][color=green]
                            > > get errors.
                            > > How can I change for a while in the project the date format in vb.code[/color][/color]
                            ([color=blue][color=green]
                            > > not in Windows) and how can I find out which date format the PC Windows[/color][/color]
                            is[color=blue][color=green]
                            > > using.[/color]
                            >
                            > 'System.Globali zation.CultureI nfo.CurrentCult ure.DateTimeFor mat'.
                            >
                            > Using a culture-specific date/time format to persist dates is never a good
                            > idea if data is exchanged between machines which are potentially running
                            > with different date/time formats. Instead, use
                            > 'CultureInfo.In variantCulture. DateTimeFormat' to format the dates when
                            > persisting them and use the invariant culture to read the date values[/color]
                            later[color=blue]
                            > on.
                            >
                            > --
                            > M S Herfried K. Wagner
                            > M V P <URL:http://dotnet.mvps.org/>
                            > V B <URL:http://classicvb.org/petition/>
                            >[/color]


                            Comment

                            • Cor Ligthert [MVP]

                              #15
                              Re: changing the date format in vb.net

                              Andreas,

                              Newsgroups are meant as a communitiy, where problems can be discussed in any
                              way by the contributers who want to learn from each other.

                              If you want only a direct answer to your questions, than you can better go
                              to a paid Microsoft Support Center or hire in another way an advisor.

                              Just my thought,

                              Cor

                              "andreas" <andreas@pandor a.be> schreef in bericht
                              news:0Sqkg.4845 28$u41.12588151 @phobos.telenet-ops.be...[color=blue]
                              > Herfried and Cor,
                              > Thanks, it is very interesting but I want ( if possible) a direct answer.
                              >
                              > When can change in Windows - Control panel the format of the date and it
                              > is
                              > important for vb.net when reading a date in plain tekst in a textfile
                              > When the windows format is f.e. yyyy/mm/dd and the textfile gives in plain
                              > tekst 31/12/2005 then I get a error.
                              > When I change the windows format in dd/mm/yyyy than the date is reading.
                              > Is it possible and how can I :
                              > Dedect in VB.net what the setting is in O.S.
                              > Change this setting in what I want in vb.net at the beginning of the
                              > program.
                              >
                              >
                              > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
                              > news:#rfMmHHkGH A.4776@TK2MSFTN GP05.phx.gbl...[color=green]
                              >> "andreas" <andreas@pandor a.be> schrieb:[color=darkred]
                              >> > When I copy a vb.net project using date formats from one PC with a[/color][/color]
                              > windows[color=green][color=darkred]
                              >> > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then[/color][/color]
                              > I[color=green][color=darkred]
                              >> > get errors.
                              >> > How can I change for a while in the project the date format in vb.code[/color][/color]
                              > ([color=green][color=darkred]
                              >> > not in Windows) and how can I find out which date format the PC Windows[/color][/color]
                              > is[color=green][color=darkred]
                              >> > using.[/color]
                              >>
                              >> 'System.Globali zation.CultureI nfo.CurrentCult ure.DateTimeFor mat'.
                              >>
                              >> Using a culture-specific date/time format to persist dates is never a
                              >> good
                              >> idea if data is exchanged between machines which are potentially running
                              >> with different date/time formats. Instead, use
                              >> 'CultureInfo.In variantCulture. DateTimeFormat' to format the dates when
                              >> persisting them and use the invariant culture to read the date values[/color]
                              > later[color=green]
                              >> on.
                              >>
                              >> --
                              >> M S Herfried K. Wagner
                              >> M V P <URL:http://dotnet.mvps.org/>
                              >> V B <URL:http://classicvb.org/petition/>
                              >>[/color]
                              >
                              >[/color]


                              Comment

                              Working...