473,395 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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?
Jul 19 '05 #1
15 2252
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
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
> 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
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
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
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
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
> 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
> 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
> 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
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
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
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
> 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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Martin Lucas-Smith | last post by:
I have a string saved in the format produced by date ('Ymd-Hms') e.g. 20050215-130257 Can anyone suggest the easiest way to present this as e.g. 13.02pm, 15/Feb/2005
7
by: martini | last post by:
Need help: I am trying to call a DB2 stored procedure that requires parameters: 4x int, date, varchar, int. I use VB6 & oledb. I'm using statements: cmd.CommandText = "{call db2admin.proc(1, 0,...
3
by: Kerri | last post by:
Hi, I have an ASPX page with a textbox where the user enters a date. I have a variable of tyope date that I populate from teh form d dtMyDate = Request.Form("txMyDate")
2
by: Thomas Beyerlein | last post by:
I am binding dates to a textbox, the date is stored in SQL in a datetime field. When it gets bound it turns it into a long date (Sunday, Dec. 25 2005), in SQL when viewing the table it views as a...
2
by: johndcal | last post by:
Hello All, I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array, for example....
7
by: Middletree | last post by:
I am trying to display dates in a spreadsheet, but the dates need to be in a format that will allow them to be sorted in Excel. The datatype in the SQL Server database is datetime. In this case, I...
9
Tormod
by: Tormod | last post by:
I'm having problems formatting a date retrieved from mysql database. When I retrieve the date it's in the format YYYY-MM-DD. I need to split the Day, Month and Year portions of the date up so that I...
0
by: Lars Hylleberg | last post by:
In my company we are runing java Webshere applications on Windows platform and connecting to DB2 V8 on z/OS mainframe. Until now we have used the type 2 JDBC driver, which are using the DB2 Connect...
1
by: Shawn29316 | last post by:
Hi, I've used a form to capture the requesters date range specifications for a set of queries forever and never cared that it took the short date entered by the requester and changed it to a...
10
by: WebCM | last post by:
There is a function: http://paste.ubuntu.com/21865 It needs GMT date in YYYY-MM-DD HH:MM:SS format - in SQL: datetime. If date is the same as today, the function returns "Today". There is one...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.