By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,616 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,616 IT Pros & Developers. It's quick & easy.

date formatting question--quick one

P: n/a
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?
Jul 19 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
No, vbscript doesn't have a function for everything like that pansy php
language. :]
Function BetterDate()
Dim sDate
sDate = Date
BetterDate = Right(Year(sDate), 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" <mi********@htomail.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
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?

Jul 19 '05 #2

P: n/a
thanks!

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

"Ray at <%=sLocation%>" <myFirstNameATlane34dotKOMM> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
No, vbscript doesn't have a function for everything like that pansy php
language. :]
Function BetterDate()
Dim sDate
sDate = Date
BetterDate = Right(Year(sDate), 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" <mi********@htomail.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
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?


Jul 19 '05 #3

P: n/a
> 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.
Jul 19 '05 #4

P: n/a
Foo Man Chew wrote:
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.


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"
Jul 19 '05 #5

P: n/a
If you are getting the date from an Access DB you could format it in the
query..

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

Bob Lehmann

"middletree" <mi********@htomail.com> wrote in message
news:eh**************@tk2msftngp13.phx.gbl...
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?

Jul 19 '05 #6

P: n/a
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\tickets\1001\0312124

"Foo Man Chew" <fo*@man.chew> wrote in message
news:ut**************@tk2msftngp13.phx.gbl...
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.

Jul 19 '05 #7

P: n/a
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" <fo*@man.chew> wrote in message
news:ut**************@tk2msftngp13.phx.gbl...
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.

Jul 19 '05 #8

P: n/a
> 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


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).
Jul 19 '05 #9

P: n/a
> 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\tickets\1001\0312124

And what's wrong with this:

\\servername\tickets\1001\20031224\

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

P: n/a
> 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.


Save it. I was making an analogy, not accusing you of being dumb about Y2K.
Jul 19 '05 #11

P: n/a
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" <fo*@man.chew> wrote in message
news:ea**************@tk2msftngp13.phx.gbl...
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.
Save it. I was making an analogy, not accusing you of being dumb about

Y2K.

Jul 19 '05 #12

P: n/a
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" <fo*@man.chew> wrote in message
news:#t*************@tk2msftngp13.phx.gbl...
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\tickets\1001\0312124

And what's wrong with this:

\\servername\tickets\1001\20031224\

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

Jul 19 '05 #13

P: n/a
Of course, I meant to say that informational comments are welcome, not "not"
"middletree" <mi********@htomail.com> wrote in message
news:uh**************@TK2MSFTNGP09.phx.gbl...
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" <fo*@man.chew> wrote in message
news:#t*************@tk2msftngp13.phx.gbl...
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\tickets\1001\0312124

And what's wrong with this:

\\servername\tickets\1001\20031224\

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


Jul 19 '05 #14

P: n/a
> 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.
Jul 19 '05 #15

P: n/a
middletree wrote:
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.

Drop it middletree. You may as well get used to it now. There is no way to
control the behavior of others in newsgroups. By posting a question here,
you are going to get a great assortment of response, some of which you may
not like. Deal with it. It is the nature of the medium. People are free to
reply in whatever manner they deem fit, and they are free to offer
unsolicited advice. And not only are they free to do so, they WILL do so.

Moreover, you should welcome it. If we were somehow restricted to only
providing the answers to the questions being asked, without adding extra
advice about things that we perceive to be problem areas, I do not think we
would be of as much help as I like to think we are.

Bob

--
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"
Jul 19 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.