473,695 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2272
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 " <mi********@hto mail.com> wrote in message
news:eh******** ******@tk2msftn gp13.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% >" <myFirstNameATl ane34dotKOMM> wrote in message
news:OW******** ******@tk2msftn gp13.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(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 " <mi********@hto mail.com> wrote in message
news:eh******** ******@tk2msftn gp13.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_da te,'mm/dd/yy') AS EventDate etc, etc...

Bob Lehmann

"middletree " <mi********@hto mail.com> wrote in message
news:eh******** ******@tk2msftn gp13.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\ti ckets\1001\0312 124

"Foo Man Chew" <fo*@man.chew > wrote in message
news:ut******** ******@tk2msftn gp13.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******** ******@tk2msftn gp13.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\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.
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2814
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
8860
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, 3, '2002-04-22', '0000000', 351)}" and cmd.CommandText = "{call db2admin.proc(1, 0, 3, 3, {d '2002-04-22'}, '0000000', 351)}" and I get following error:
3
1137
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
1528
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 shortdate. When inserted to SQL the datetimepicker format for the date is short. I have not had a problem with the formatting of a date to a textbox before, but this time I am using the CurrencyManager to navigate though several records. This is...
2
2162
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. ============================================================= while (($data = fgetcsv($handle,5000, ",")) !== FALSE) { $mydate = $data; // here is the array value that holds the date }
7
3058
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 need to display the date only, not the time. But I don't want to change the datatype in the database because the time is used in other places. So what I am doing is pulling it out of the database, then modifying it in ASP/VBScript by using the...
9
2122
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 can represent them in a drop down menu. I've posted my source code below, such as it is. I need a function of some kind to allow me to manipulate the $row. #connect to mysql $conn = @mysql_connect( "host", "username", "password" )...
0
2462
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 software to obtain connection. Right now we are planning to move to type 4 JDBC driver, which supports direct connection to DB2 V8 on z/OS using native TCP/IP. That is, we don't need the DB2 Connect overhead anymore. But we seem to have a problem...
1
1409
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 number when it stored the date for later use. Now I'm trying to subtract that number from a date supplied from a system database, which is in short date format, and the output looks like a short date instead of a number. Can someone help me get a...
10
4021
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 problem. This function does not recognize time zones. How to adjust date to user's time zone? Is converting to timestamp() and then to format readable to visitors the one and only solution (e.g. strtotime() + date() OR DateTime object)? Perhaps,...
0
8638
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8578
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8854
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4345
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3013
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2278
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.