473,795 Members | 3,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying Dates

I have a windows form with several fields. One of the fields is a date. I use
DateTimePicker to enter and format the date. In my SQL table the date si
stored as follows "01/10/2005" and this is what I wont. When I display the
date with a 'fill or select' this is what I get '01/10/2005 12:00'. What am
I doing wrong? Please Help.
--
Norm Bohana
Nov 17 '05 #1
5 1829
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information (or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00 is
reflective of midnight on that day, which is technically the first moment of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
I have a windows form with several fields. One of the fields is a date. I
use
DateTimePicker to enter and format the date. In my SQL table the date si
stored as follows "01/10/2005" and this is what I wont. When I display
the
date with a 'fill or select' this is what I get '01/10/2005 12:00'. What
am
I doing wrong? Please Help.
--
Norm Bohana

Nov 17 '05 #2
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1 .Format = DateTimePickerF ormat.Custom;
dateTimePicker1 .CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1 .Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information (or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00 is
reflective of midnight on that day, which is technically the first moment of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
I have a windows form with several fields. One of the fields is a date. I
use
DateTimePicker to enter and format the date. In my SQL table the date si
stored as follows "01/10/2005" and this is what I wont. When I display
the
date with a 'fill or select' this is what I get '01/10/2005 12:00'. What
am
I doing wrong? Please Help.
--
Norm Bohana


Nov 17 '05 #3
Ahh, you didn't mention that you were binding it to a textbox.

When you create the binding, what you can do is subscribe to the Parse
and the Format events on the binding. You can use this to format the date
as you wish in the textbox, as well as parse the date when the text is set
and needs to be persisted back to the value.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1 .Format = DateTimePickerF ormat.Custom;
dateTimePicker1 .CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1 .Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with
the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information
(or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00
is
reflective of midnight on that day, which is technically the first moment
of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
>I have a windows form with several fields. One of the fields is a date.
>I
>use
> DateTimePicker to enter and format the date. In my SQL table the date
> si
> stored as follows "01/10/2005" and this is what I wont. When I display
> the
> date with a 'fill or select' this is what I get '01/10/2005 12:00'.
> What
> am
> I doing wrong? Please Help.
> --
> Norm Bohana


Nov 17 '05 #4
I am sorry, Thanks much.
--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Ahh, you didn't mention that you were binding it to a textbox.

When you create the binding, what you can do is subscribe to the Parse
and the Format events on the binding. You can use this to format the date
as you wish in the textbox, as well as parse the date when the text is set
and needs to be persisted back to the value.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1 .Format = DateTimePickerF ormat.Custom;
dateTimePicker1 .CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1 .Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with
the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information
(or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00
is
reflective of midnight on that day, which is technically the first moment
of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
>I have a windows form with several fields. One of the fields is a date.
>I
>use
> DateTimePicker to enter and format the date. In my SQL table the date
> si
> stored as follows "01/10/2005" and this is what I wont. When I display
> the
> date with a 'fill or select' this is what I get '01/10/2005 12:00'.
> What
> am
> I doing wrong? Please Help.
> --
> Norm Bohana


Nov 17 '05 #5
Nicholas, I am sorry, I cannot find out how to implement your suggestion. I
found the events ok, but I do not know how to setup it up in the textbox.
Can you point me in the right direction please!!
--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Ahh, you didn't mention that you were binding it to a textbox.

When you create the binding, what you can do is subscribe to the Parse
and the Format events on the binding. You can use this to format the date
as you wish in the textbox, as well as parse the date when the text is set
and needs to be persisted back to the value.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:D9******** *************** ***********@mic rosoft.com...
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1 .Format = DateTimePickerF ormat.Custom;
dateTimePicker1 .CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1 .Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with
the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information
(or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00
is
reflective of midnight on that day, which is technically the first moment
of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"nbohana" <nb*****@discus sions.microsoft .com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
>I have a windows form with several fields. One of the fields is a date.
>I
>use
> DateTimePicker to enter and format the date. In my SQL table the date
> si
> stored as follows "01/10/2005" and this is what I wont. When I display
> the
> date with a 'fill or select' this is what I get '01/10/2005 12:00'.
> What
> am
> I doing wrong? Please Help.
> --
> Norm Bohana


Nov 17 '05 #6

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

Similar topics

2
2361
by: Russ | last post by:
I've got a report that puts dates at the top of columns and the user is prompted to enter a beginning date when the report is opened. That date is put in a textbox in the first column like this: =DateValue() Then the next columns are textboxes that add 7 to the previous column for the date display of the next week like this: =+7
3
1907
by: Tim Graichen | last post by:
In subFormC, I would like to display only those records that have TrialDate and CompanyCode equal to TrialDate and CompanyCode in subFormB. Can somebody please help me? Thanks Tim
3
4664
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail size version of each photograph horizontally across the form, then have the photgraphs "word wrap" (picture wrap ?) at the right end of the form onto the next "line" of photographs. Does anyone know how this can be done? Obviously, displaying...
9
3226
by: Bosconian | last post by:
I must be having a brain freeze because I can't figure out how to display dates older than 1970. I have birth dates stored in MySQL as "date" data types (exp. 1955-04-06). I'd like to display as "April 4, 1955". I've tried using date("F j, Y"), but only get "December 31, 1969". I'm using PHP 4.3.8. Any suggestions would be appreciated.
4
1701
by: jkuruvil | last post by:
I need to print a report of a bunch of records that falls between certain dates. Some records have dates and some don't. I did a UNION query to look for everything that falls between these two dates and everything that have NULL in date fields. Records get sorted in an ascending order. So, now I do see all the records, but I like to display records without dates in the end with another title. How could I do this.
2
1188
by: gubbachchi | last post by:
Hi all, How will I change the color of the dates in the javascript calendar which already has some event entered for it. Like I have a form where the user enters the id and selects the date from calendar and leaves a comment for that date. This data will be stored in mysql database. How can I change the color of dates in calendar so that if the user has already entered some comment for that then that date should become green color. How...
5
1951
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date : combobox of month(emonth) & combobox of year(eyear) I want the records between this month and year.i have written the below query for that: suppose, smonth=01,emonth=08,syear=2000,eyear=2005
2
1031
by: ravi | last post by:
hi friends, can we display last ten dates from current system date using sql query. example todays date 19/4/2008 from this last 10 days 18/4/2008 17/4/2008 16/4/2008 ' '
8
4276
by: rjlorenzo | last post by:
Good Day Everyone, Requesting for your expertise please, in my program the user has to enter the agent name and the from date and to date inorder to display the record. I have to use 2 conditions. First look for the record with the same agent and display all record for that agent but the date should be within the two dates enter. Below are my codes, when running i got the error message invalid data type. In my database the PROD_ENTERED is...
1
5754
by: vaibhavideshpandemca | last post by:
How to display the records between 2 dates in ruby on rails I have 2 text boxes where i fill the 2 dates and want to display the records between these 2 dates from the database tables Thanks in advance, vaibhavi,,,
0
9672
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
10437
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
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
10164
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
10001
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
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
3
2920
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.