date formatting question--quick one

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

    date formatting question--quick one

    I know I could write one, but is there a built-in VBScript/ASP function to
    take a date, which is in the format mm/dd/yyyy, and put it in a yymmdd
    format?


  • Ray at

    #2
    Re: date formatting question--quick one

    No, vbscript doesn't have a function for everything like that pansy php
    language. :]


    Function BetterDate()
    Dim sDate
    sDate = Date
    BetterDate = Right(Year(sDat e), 2) & Right("0" & Month(sDate), 2) &
    Right("0" & Day(sDate), 2)
    End Function

    Response.Write BetterDate

    You may want to conder yyyy over yy though.

    Ray at home


    "middletree " <middletree@hto mail.com> wrote in message
    news:ehWqc1ayDH A.3116@tk2msftn gp13.phx.gbl...[color=blue]
    > I know I could write one, but is there a built-in VBScript/ASP function to
    > take a date, which is in the format mm/dd/yyyy, and put it in a yymmdd
    > format?
    >
    >[/color]


    Comment

    • middletree

      #3
      Re: date formatting question--quick one

      thanks!

      Gotta have the yy, because the boss has a special request.

      "Ray at <%=sLocation% >" <myFirstNameATl ane34dotKOMM> wrote in message
      news:OWFAFSdyDH A.3888@tk2msftn gp13.phx.gbl...[color=blue]
      > No, vbscript doesn't have a function for everything like that pansy php
      > language. :]
      >
      >
      > Function BetterDate()
      > Dim sDate
      > sDate = Date
      > BetterDate = Right(Year(sDat e), 2) & Right("0" & Month(sDate), 2) &
      > Right("0" & Day(sDate), 2)
      > End Function
      >
      > Response.Write BetterDate
      >
      > You may want to conder yyyy over yy though.
      >
      > Ray at home
      >
      >
      > "middletree " <middletree@hto mail.com> wrote in message
      > news:ehWqc1ayDH A.3116@tk2msftn gp13.phx.gbl...[color=green]
      > > I know I could write one, but is there a built-in VBScript/ASP function[/color][/color]
      to[color=blue][color=green]
      > > take a date, which is in the format mm/dd/yyyy, and put it in a yymmdd
      > > format?
      > >
      > >[/color]
      >
      >
      >[/color]


      Comment

      • Foo Man Chew

        #4
        Re: date formatting question--quick one

        > Gotta have the yy, because the boss has a special request.

        Tell the boss the stone age is over. It's time to remember the mentality
        that caused the Y2K problem in the first place, and a similar mentality that
        gives people fits trying to figure out if 03/04/02 is March 4, 2002, or
        April 3, 2002, or April 2, 2003, or Feb. 4, 2003.


        Comment

        • Bob Barrows

          #5
          Re: date formatting question--quick one

          Foo Man Chew wrote:[color=blue][color=green]
          >> Gotta have the yy, because the boss has a special request.[/color]
          >
          > Tell the boss the stone age is over. It's time to remember the
          > mentality that caused the Y2K problem in the first place, and a
          > similar mentality that gives people fits trying to figure out if
          > 03/04/02 is March 4, 2002, or April 3, 2002, or April 2, 2003, or
          > Feb. 4, 2003.[/color]

          Ease up will ya? He did not say he wanted to store the dates this way,
          merely display them (I think). It's not as if it was even possible to store
          them with this format (unless the mistake of using a text field to store
          them was being made.)

          Bob Barrows

          --
          Microsoft MVP - ASP/ASP.NET
          Please reply to the newsgroup. This email account is my spam trap so I
          don't check it very often. If you must reply off-line, then remove the
          "NO SPAM"


          Comment

          • Bob Lehmann

            #6
            Re: date formatting question--quick one

            If you are getting the date from an Access DB you could format it in the
            query..

            SELECT FORMAT(event_da te,'mm/dd/yy') AS EventDate etc, etc...

            Bob Lehmann

            "middletree " <middletree@hto mail.com> wrote in message
            news:ehWqc1ayDH A.3116@tk2msftn gp13.phx.gbl...[color=blue]
            > I know I could write one, but is there a built-in VBScript/ASP function to
            > take a date, which is in the format mm/dd/yyyy, and put it in a yymmdd
            > format?
            >
            >[/color]


            Comment

            • middletree

              #7
              Re: date formatting question--quick one

              Good night, but you're presumptive and rude!

              If you must know, I am creating folders, based on which date some support
              files were sent, I have been asked to put files into folders with a format
              of yymmdd, so if I wanted to see the trace files that were sent in regards
              to Ticket 1001, on Dec 24, I'd just go to \\servername\ti ckets\1001\0312 124



              "Foo Man Chew" <foo@man.chew > wrote in message
              news:ut5DbJeyDH A.3116@tk2msftn gp13.phx.gbl...[color=blue][color=green]
              > > Gotta have the yy, because the boss has a special request.[/color]
              >
              > Tell the boss the stone age is over. It's time to remember the mentality
              > that caused the Y2K problem in the first place, and a similar mentality[/color]
              that[color=blue]
              > gives people fits trying to figure out if 03/04/02 is March 4, 2002, or
              > April 3, 2002, or April 2, 2003, or Feb. 4, 2003.
              >
              >[/color]


              Comment

              • middletree

                #8
                Re: date formatting question--quick one

                And for the record, our company makes software used for deposits and
                withdrawals in 15 of the 30 largest banks in the world, so you can be sure
                that we have a handle on the Y2K issue.


                "Foo Man Chew" <foo@man.chew > wrote in message
                news:ut5DbJeyDH A.3116@tk2msftn gp13.phx.gbl...[color=blue][color=green]
                > > Gotta have the yy, because the boss has a special request.[/color]
                >
                > Tell the boss the stone age is over. It's time to remember the mentality
                > that caused the Y2K problem in the first place, and a similar mentality[/color]
                that[color=blue]
                > gives people fits trying to figure out if 03/04/02 is March 4, 2002, or
                > April 3, 2002, or April 2, 2003, or Feb. 4, 2003.
                >
                >[/color]


                Comment

                • Foo Man Chew

                  #9
                  Re: date formatting question--quick one

                  > Ease up will ya? He did not say he wanted to store the dates this way,[color=blue]
                  > merely display them (I think). It's not as if it was even possible to[/color]
                  store[color=blue]
                  > them with this format[/color]

                  Obviously not. Of course, my problem with the confusion caused by
                  non-standard date formats has nothing to do with storage, but rather with
                  interpretation (both in passing them to and from a database, between
                  software, etc., and display to humans).


                  Comment

                  • Foo Man Chew

                    #10
                    Re: date formatting question--quick one

                    > of yymmdd, so if I wanted to see the trace files that were sent in regards[color=blue]
                    > to Ticket 1001, on Dec 24, I'd just go to[/color]
                    \\servername\ti ckets\1001\0312 124

                    And what's wrong with this:

                    \\servername\ti ckets\1001\2003 1224\

                    ....other than it's much more clear to *anyone* (not just the author of the
                    software) what the date actually is.


                    Comment

                    • Foo Man Chew

                      #11
                      Re: date formatting question--quick one

                      > And for the record, our company makes software used for deposits and[color=blue]
                      > withdrawals in 15 of the 30 largest banks in the world, so you can be sure
                      > that we have a handle on the Y2K issue.[/color]

                      Save it. I was making an analogy, not accusing you of being dumb about Y2K.


                      Comment

                      • middletree

                        #12
                        Re: date formatting question--quick one

                        Don't tell me what to save.

                        And saying that my boss is in the stone age IS an accusation of being dumb.


                        "Foo Man Chew" <foo@man.chew > wrote in message
                        news:eardcj0yDH A.2452@tk2msftn gp13.phx.gbl...[color=blue][color=green]
                        > > And for the record, our company makes software used for deposits and
                        > > withdrawals in 15 of the 30 largest banks in the world, so you can be[/color][/color]
                        sure[color=blue][color=green]
                        > > that we have a handle on the Y2K issue.[/color]
                        >
                        > Save it. I was making an analogy, not accusing you of being dumb about[/color]
                        Y2K.[color=blue]
                        >
                        >[/color]


                        Comment

                        • middletree

                          #13
                          Re: date formatting question--quick one

                          I asked a question about how to do something. Any comments or info you can
                          share which will help me are not. The kind of comments you did offer are
                          not. It is not for you to decide how I should name our folders.


                          "Foo Man Chew" <foo@man.chew > wrote in message
                          news:#t0NPj0yDH A.540@tk2msftng p13.phx.gbl...[color=blue][color=green]
                          > > of yymmdd, so if I wanted to see the trace files that were sent in[/color][/color]
                          regards[color=blue][color=green]
                          > > to Ticket 1001, on Dec 24, I'd just go to[/color]
                          > \\servername\ti ckets\1001\0312 124
                          >
                          > And what's wrong with this:
                          >
                          > \\servername\ti ckets\1001\2003 1224\
                          >
                          > ...other than it's much more clear to *anyone* (not just the author of the
                          > software) what the date actually is.
                          >
                          >[/color]


                          Comment

                          • middletree

                            #14
                            Re: date formatting question--quick one

                            Of course, I meant to say that informational comments are welcome, not "not"


                            "middletree " <middletree@hto mail.com> wrote in message
                            news:uh5xkX2yDH A.1740@TK2MSFTN GP09.phx.gbl...[color=blue]
                            > I asked a question about how to do something. Any comments or info you[/color]
                            can[color=blue]
                            > share which will help me are not. The kind of comments you did offer are
                            > not. It is not for you to decide how I should name our folders.
                            >
                            >
                            > "Foo Man Chew" <foo@man.chew > wrote in message
                            > news:#t0NPj0yDH A.540@tk2msftng p13.phx.gbl...[color=green][color=darkred]
                            > > > of yymmdd, so if I wanted to see the trace files that were sent in[/color][/color]
                            > regards[color=green][color=darkred]
                            > > > to Ticket 1001, on Dec 24, I'd just go to[/color]
                            > > \\servername\ti ckets\1001\0312 124
                            > >
                            > > And what's wrong with this:
                            > >
                            > > \\servername\ti ckets\1001\2003 1224\
                            > >
                            > > ...other than it's much more clear to *anyone* (not just the author of[/color][/color]
                            the[color=blue][color=green]
                            > > software) what the date actually is.
                            > >
                            > >[/color]
                            >
                            >[/color]


                            Comment

                            • Foo Man Chew

                              #15
                              Re: date formatting question--quick one

                              > I asked a question about how to do something.

                              And I'm just trying to understand the advantage of using 2-digit years. You
                              have shown me nothing substantial, so I'll assume you don't have a good
                              reason.


                              Comment

                              Working...