Current location: Hot Scripts Forums » Programming Languages » ASP » Date From Access 2000 Database

Date From Access 2000 Database

Reply
  #1  
Old 09-18-03, 03:02 PM
Kaikki Kaikki is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Europe
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Date From Access 2000 Database

Hi there

This is probably a very stupid question from an ASP beginner but I hope that somebody will be kind enough to help me out here.

I am sending a Date that the user enters from a form on my asp.page, to the Access 2000 Database.

I have set the field in the Access database table which stores the Date to, DATA TYPE: Date/time and the FORMAT: Medium Date.

In the database the date is then displayed as eg. 14-Aug-03.

However when I display the date on my DETAIL Page it looks like this 14-08-2003. I want it to display as 14-08-03.

To display the date on my DETAIL page I use the following code:

<td width="9%" align="center" bgcolor="#FFFFFF" height="18"><p style="margin-top: 0; margin-bottom: 0"><font face="Verdana, Arial, Helvetica, sans-serif" style="font-size: 11px"><%=(rsDetail.Fields.Item("AD_DATE1").Value)% ></a></font></p></td>

How can I control the way the date is displayed? Do I have to change some settings in the Access Database that holds the Date Field, or do I require some kind of script in the code that is calling the script.

Thankyou in advance.

Regards
Kaikki
Reply With Quote
  #2  
Old 09-20-03, 02:05 AM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Kaikki
Hi there

This is probably a very stupid question from an ASP beginner but I hope that somebody will be kind enough to help me out here.

I am sending a Date that the user enters from a form on my asp.page, to the Access 2000 Database.

I have set the field in the Access database table which stores the Date to, DATA TYPE: Date/time and the FORMAT: Medium Date.

In the database the date is then displayed as eg. 14-Aug-03.

However when I display the date on my DETAIL Page it looks like this 14-08-2003. I want it to display as 14-08-03.

To display the date on my DETAIL page I use the following code:

<td width="9%" align="center" bgcolor="#FFFFFF" height="18"><p style="margin-top: 0; margin-bottom: 0"><font face="Verdana, Arial, Helvetica, sans-serif" style="font-size: 11px"><%=(rsDetail.Fields.Item("AD_DATE1").Value)% ></a></font></p></td>

How can I control the way the date is displayed? Do I have to change some settings in the Access Database that holds the Date Field, or do I require some kind of script in the code that is calling the script.

Thankyou in advance.

Regards
Kaikki
This should answer a few questions.

http://www.learnasp.com/learn/datetime.asp
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
  #3  
Old 09-24-03, 05:31 AM
Stealth Stealth is offline
1337 pr0gr4mm3r
 
Join Date: Jun 2003
Location: Glasgow, Scotland
Posts: 188
Thanks: 0
Thanked 0 Times in 0 Posts
The link Shane posted is better but if you want the exact date you specified (14-August-2003) try:

<% = day(rsDetail.Fields.Item("AD_DATE1").Value) & "-" & MonthName(Month(rsDetail.Fields.Item("AD_DATE1").V alue) & "-" & Year(rsDetail.Fields.Item("AD_DATE1").Value)) %>


big innit
Reply With Quote
  #4  
Old 09-25-03, 08:05 AM
Kaikki Kaikki is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Europe
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Thankyou For your Kind Feedback

Hi Shane and Stealth

Thankyou both very very much for your very helpful feedback which is highly appreciated.

Shane that is a great link that you provided me with, I have bookmarked it and will most definately be using it often in the future. However the problem is that it was unable to solve the problem I am having.

I tried to use the VBShortdate with value 2 setting which is supposed to set my date to display as mm/dd/yy. The mm and dd work fine, however the yy is still giving me problems. The date display as eg. 14-08-2003. I want the date to display as 14-08-03 (i.e. Year as 03 instead of 2003). Is this something that can be done or is there no way to make the year display with 2 digits only.

Stealth also a very big thankyou to you for taking the time to provide me with an example. I think that you misunderstood me. The date in my database is written as 14-Aug-2003. On my webpage where I am displaying the date I would like it to read as 14-08-03 as described above.

If any of you have any other ideas of how to solve this "I hope" small program please let me know.

Thanks again :-) :-)

Kind Regards
Kaikki :-)
Reply With Quote
  #5  
Old 09-25-03, 07:04 PM
Stealth Stealth is offline
1337 pr0gr4mm3r
 
Join Date: Jun 2003
Location: Glasgow, Scotland
Posts: 188
Thanks: 0
Thanked 0 Times in 0 Posts
ah i see.

its good practice to have all your dates in a website in american format (mm/dd/yyyy) so problems like this dont arise ;-)



only other thing i can think of is
<%=Response.Write Year(Right(FormatDateTime("14-Aug-2003", 2), 2)) %>
which will return 03 and applies for another 96 years
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Share database over the Internet nitinkedia The Lounge 2 11-20-03 03:07 PM
SQL database registration form help vinhkhuong PHP 3 10-10-03 04:49 AM
tracking down a database problem ... bjmcintosh ASP 1 08-29-03 08:52 AM
Share database over the internet nitinkedia PHP 0 07-11-03 01:22 AM
Share database over the Internet nitinkedia New Members & Introductions 1 07-10-03 03:50 PM


All times are GMT -5. The time now is 12:26 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)