473,666 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't get rid of the time part of a date

I have a simple query that queries an access database. One of the fields is
date/time.

I use this to extract the date from the field in access:
CDate(objDataRe ader("date")).T oString

When the webform is viewed, date and time both show up. (eg. 12/12/2005
12:00:00 AM) How do I get rid of the time?

I've also tried CDate(objDataRe ader("date")).D ate.ToString

Is it the CDate function? Should I not be using that?

TIA,
Jim
Jan 5 '06 #1
3 2002
It's ToShortDateTime () or something :)

Karl

--
http://www.openmymind.net/

"Jim in Arizona" <ti*******@hotm ail.com> wrote in message
news:OG******** ******@tk2msftn gp13.phx.gbl...
I have a simple query that queries an access database. One of the fields is
date/time.

I use this to extract the date from the field in access:
CDate(objDataRe ader("date")).T oString

When the webform is viewed, date and time both show up. (eg. 12/12/2005
12:00:00 AM) How do I get rid of the time?

I've also tried CDate(objDataRe ader("date")).D ate.ToString

Is it the CDate function? Should I not be using that?

TIA,
Jim

Jan 5 '06 #2

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eh******** ******@TK2MSFTN GP15.phx.gbl...
It's ToShortDateTime () or something :)

Karl

--
http://www.openmymind.net/


CDate(objDataRe ader("date")).T oShortDateStrin g

That was it, Karl.

Thanks,
Jim
Jan 5 '06 #3
Jim in Arizona wrote:
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eh******** ******@TK2MSFTN GP15.phx.gbl...
It's ToShortDateTime () or something :)

Karl

--
http://www.openmymind.net/


CDate(objDataRe ader("date")).T oShortDateStrin g

That was it, Karl.

Thanks,
Jim


I might also recommend the static String.Format method, where you can
define formats like MM/dd/yyyy, as opposed to relying on system settings
that could change. Just another option:

http://msdn.microsoft.com/library/de...rmattopic1.asp

--
craig
Microsoft MVP - ASP/ASP.NET
Jan 6 '06 #4

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

Similar topics

2
2189
by: Jerry | last post by:
With the following code I am trying to simply set and display the current date time in an input box. The input box will not accept a variable that contains any spaces (i.e., a space between date and time). It works if I hardcode a date time, but I need the current date time. The code also works as long as it is not within an input box (see 3rd line below) <tr><td align="right"><strong>Start Time:</strong></td><td align="left"><input...
3
35080
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
3
11725
by: Reney | last post by:
I am using Access Database in my program. The column in the table that I am going to use has date/time value with Medium Time selected. (HH:mm). The program is recording a clock in time to this field, which is the time when the entry is made. If you check the database, it shows the correct time in the correct format. But when you are calling it with a dataset and showing with a datagrid, it doesn't show the time value but it always shows...
7
4080
by: Brett Edman | last post by:
I created a UTC clock using this: UTCTime = MyTime.ToUniversalTime() Now that we've turned the clocks ahead 1 hour for daylight savings time, the clock is reporting the wrong UTC time. It is reporting UTC + 1 hour. Is this a bug or is there a way I can querey for daylight time and make the adjustment in my application? Thanks.
6
4868
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
2
2410
by: Darhl Thomason | last post by:
I'm converting my Access 2003 VBA app. I have a number of date fields in my db that I want to use the date/time picker control with, but if there is no entry in my database, I want the date/time picker to show no date. Right now the first time it shows a blank date record, it inserts today's date. But as I move through the db and it finds a date in that field, the next time it finds a blank data record, it uses the last one as the...
6
14442
by: rohayre | last post by:
Im a long time java developer and actually have never done anything with java scripting. I'd like to write a short simple script for calculating a date in the future based on today's date and a letter. Can I use javascripting to create a webpage to allow a user to enter a letter and then click a button to find a future calendar date? I'm just not sure how much user interaction scripting allows. Does java scripting allow buttons, textfields...
2
6087
by: john | last post by:
From an Excel-import I have an access table with a datetime field of wich both date and time are entered. I've set the field's notation properties to Short Date. When I view the table in tableview I only see the date but when I click in the field I see date and time. Is there an easy way to delete all the time values in that field? as I don't need them. Thanks in advance, john
109
25788
by: zaidalin79 | last post by:
I have a java class that goes for another week or so, and I am going to fail if I can't figure out this simple program. I can't get anything to compile to at least get a few points... Here are the assignments... 4. CheckPoint: Inventory Program Part 1 • Resource: Java: How to Program • Due Date: Day 5 forum • Choose a product that lends itself to an inventory (for example, products at your workplace, office supplies, music CDs, DVD...
3
5261
by: Magesh | last post by:
How date-time attributes of a file are represented in the structure "struct stat"? Coz as I noted they found to be unsigned integers and I donno how they are interpreted as date & time in the members st_atime, st_mtime, and st_ctime. I don't want any lib fun that returns the corresponding time formatted string coz what I want to know is the interpretation of date-time in those members so that I could extract them and use it for some...
0
8445
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
8781
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...
0
7386
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...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
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...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
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
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.