473,396 Members | 1,774 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,396 software developers and data experts.

format date in asp

Hello,
Can someone help me with this request?
1. Data in my access database have the format "9/10 2005"
2. When I show all dates within an asp page I get the following format
"9/10/2005"

The format I want to show in my asp page is the following format "9/10-05"
!!!
Please help!!

// Kenneth
Nov 22 '05 #1
3 1989
1. If not already done store dates using the date datatype instead of
text... How they look is a formatting issue not a storage issue.

2. My personal preference is to use my own formatting function (you can use
the year, month, day function for examples)

For example Month(myDate) & "/" & Day(MyDate) & "-" & Right(Year(MyDate),2)
depending on the exact format you want would be a first step. Do this in a
function...

--
Patrice

"news" <ne**@sitebiz.se> a écrit dans le message de
news:Or**************@TK2MSFTNGP12.phx.gbl...
Hello,
Can someone help me with this request?
1. Data in my access database have the format "9/10 2005"
2. When I show all dates within an asp page I get the following format
"9/10/2005"

The format I want to show in my asp page is the following format "9/10-05"
!!!
Please help!!

// Kenneth

Nov 23 '05 #2
"news" wrote in message news:Or**************@TK2MSFTNGP12.phx.gbl...
: Can someone help me with this request?
: 1. Data in my access database have the format "9/10 2005"
: 2. When I show all dates within an asp page I get the following format
: "9/10/2005"
:
: The format I want to show in my asp page is the following format "9/10-05"

Two ways: assuming rs = recordset, mydate = db column name

1.

dim arrDate
if not (rs.BOF or rs.EOF) then
arrDate = split(rs("mydate"),"/")
rs.Close
set rs = nothing
conn.Close
set conn = nothing
Response.Write arrDate(0) & "/" & arrDate(1) & "-" & right(arrDate(2),2)
else
Response.Write "No records returned."
end if

2.
dim d
if not(rs.BOF or rs.EOF) then
d = CDate(rs("mydate"))
rs.Close
set rs = nothing
conn.Close
set conn = nothing
Response.Write month(d) & "/" & day(d) & "-" & right(year(d),2)
else
Response.Write "No records returned."
end if

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Nov 23 '05 #3
http://www.powerasp.com/content/new/...e-and-time.asp
"news" <ne**@sitebiz.se> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
Hello,
Can someone help me with this request?
1. Data in my access database have the format "9/10 2005"
2. When I show all dates within an asp page I get the following format
"9/10/2005"

The format I want to show in my asp page is the following format "9/10-05"
!!!
Please help!!

// Kenneth

Nov 27 '05 #4

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

Similar topics

1
by: jt | last post by:
I posted this yesterday, but I am not seeing this out yet: I am having problems with updating a date field in a certain format. The data is stored in an Oracle database. The date is...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
2
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
10
by: Jack | last post by:
Hi, I cannot get the date format correctly in dynamic sql statement, after trying various ways of handling it. I need some help with the date format in the following dynamic sql statement. Any...
5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
13
by: Roy | last post by:
Hi all, I'm creating a project that should always use this date format when displays the dates or create dates. The back end database is a SQL Server and I like to know what is the logical way...
20
by: andreas | last post by:
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...
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
16
by: Mik | last post by:
I apologise if this post seems a little basic, but I am a newbie and have NO access knowledge. I have downloaded the Accounts Ledger from the Microsoft Website. It allows the user to review a...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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,...

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.