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

Date and time formatting not working (apparently)...

patjones
931 Expert 512MB
Good afternoon all,

This is one of those seemingly simple problems. I've searched through many posts here, and many people have date and time issues, but not quite what mine is.

I've got a table called tblTicket, with a field fldReceivedDateTime (among many other non-date/time fields). This field is of Date/Time type, and formatted like "mm/dd/yy h:nn:ss AM/PM". Whenever a record is added, I stamp the record with the current date/time in that field. The assignment in the VB module looks like:

Expand|Select|Wrap|Line Numbers
  1. !fldReceivedDateTime = DateTime.Now
Later on, when I go to display the information in a text box on a form, txtReceivedDate, using

Expand|Select|Wrap|Line Numbers
  1. Me.txtReceivedDate = !fldReceivedDateTime
it displays as a number. For example, 12/20/07 9:36:01 AM appears in the text box as 39436.4000115741. This happens despite the fact that I have the text box formatted exactly the same way as the field in the table (mm/dd/yy h:nn:ss AM/PM). Nothing I do seems to rectify this.

Thanks!
Dec 21 '07 #1
2 1808
patjones
931 Expert 512MB
In addition, when I set a breakpoint in the VB code at the point where I make the textbox assignment, and look at the value that VB is passing to the textbox, it is exactly what I want. This leads me to believe that there is something wrong with the textbox or form itself...

Thanks again.
Dec 21 '07 #2
patjones
931 Expert 512MB
Problem fixed.

I forgot that, as part of my form's initiailization process in the VB module, I was going through all the text boxes, clearing them, and setting the format equal to ">"...all caps. You can't put a date value into a text box formatted in all caps. So I set the format for my date text boxes equal to "General Date", and it works fine.
Dec 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Hebar Tiltwobler | last post by:
I need to figure out if the current date (passed in as a string) is equal to or greater then a field in my database in the format of- M/D/YYYY AND if the date is less then another field in my...
7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
4
by: Paul | last post by:
Hi, Everything went fine getting a short date format out of SQL into my DataGrid with this: <%# DataBinder.Eval(Container.DataItem, "Created", "{0:d}")%> Then I got too fancy in SQL and...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
29
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
7
by: Katherine | last post by:
I'm trying to filter the records on the mainform (MailingList) of my database using a field contained in a subform (Donations). I was basing my code off Allen Browne's Access Tips page (here:...
1
by: jonny | last post by:
Option Explicit Private mdTarget1 As Date Private mdTarget2 As Date ' called on form load Public Sub SetRecordStartTime() mdTarget1 = DateAdd("n", 60, Time) mdTarget2 = DateAdd("n", 120,...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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...

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.