hi
db : sql server 2000
lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
in my textbox date is in the format of 2/12/2006 and i'm inserting as it
is.
and time is in teh fromat of 10:30 and i'm inserting as it is.
but after retrieving and displaying in data grid it is diplsying the
filed 1 like this.
2/12/2006 12:00:00 AM
and field is displaying like this.
1/1/1900 12:00:00 PM
but i need data to be displayed in field 1 as 2/12/2006
and in field 2 as 10:30.
can anybody tell me how to do this. its very urgent for me.
thanx in advacne
yoshitha 6 4434
I would do a trace to see which statement is sent. It lloks like updating
the time file dis missing from the statement.
As a side note you could perhaps store both the date and time into the same
filed even if the UI doesn't do this. It lloks like to me this is a single
information (and it could be easier when handling this in the db rather than
always adding those two files to do datetime comparisons).
--
Patrice
"yoshitha" <gu**********@y ahoo.co.in> a écrit dans le message de
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. hi
db : sql server 2000 lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
in my textbox date is in the format of 2/12/2006 and i'm inserting as it
is.
and time is in teh fromat of 10:30 and i'm inserting as it is.
but after retrieving and displaying in data grid it is diplsying the
filed 1 like this.
2/12/2006 12:00:00 AM
and field is displaying like this.
1/1/1900 12:00:00 PM
but i need data to be displayed in field 1 as 2/12/2006 and in field 2 as 10:30.
can anybody tell me how to do this. its very urgent for me.
thanx in advacne
yoshitha
Yoshitha,
You'll only need one field in the database. The database's DateTime field is
always a combination of date and time. You should store your values as a
single datetime (SQL Server 2005 was supposed to include separate date and
time fields but they were removed from the final release....).
When you store your date and time in the server just combine them:
Dim MyDate As New DateTime([Year], [Month], [Day], [Hour], [Minute],
[Seconds])
SqlCommand1.Par ameters.Add("@D ate", Data.SqlDbType. DateTime).Value = MyDate
Then in your datagrid use string formatting to display just the portion you
want:
(You say your using a datagrid so I assume you're using .NET 1.1?)
<asp:BoundColum n DataField="Crea teDate" HeaderText="Dat e"
DataFormatStrin g="{0:d}">
<asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e"
DataFormatStrin g="{0:t">
Using the dataformat string you may display just the short date (lowercase
"d") and just the short time (lowercase "t") of the datetime column.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"yoshitha" <gu**********@y ahoo.co.in> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. hi
db : sql server 2000 lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
in my textbox date is in the format of 2/12/2006 and i'm inserting as it
is.
and time is in teh fromat of 10:30 and i'm inserting as it is.
but after retrieving and displaying in data grid it is diplsying the
filed 1 like this.
2/12/2006 12:00:00 AM
and field is displaying like this.
1/1/1900 12:00:00 PM
but i need data to be displayed in field 1 as 2/12/2006 and in field 2 as 10:30.
can anybody tell me how to do this. its very urgent for me.
thanx in advacne
yoshitha
i used the follwoing statement in data grid
<asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e"
DataFormatStrin g="{0:t">
then it is showing time in 12 hours format but i want to display it as 24
hours format.
for eg in data base the data is stored as 18:30
and after using the above statement in the grid it is displaying 6:30
can you tell me how to display in 24 hours format?
"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in
message news:ux******** *******@TK2MSFT NGP10.phx.gbl.. . Yoshitha,
You'll only need one field in the database. The database's DateTime field is always a combination of date and time. You should store your values as a single datetime (SQL Server 2005 was supposed to include separate date and time fields but they were removed from the final release....).
When you store your date and time in the server just combine them:
Dim MyDate As New DateTime([Year], [Month], [Day], [Hour], [Minute], [Seconds])
SqlCommand1.Par ameters.Add("@D ate", Data.SqlDbType. DateTime).Value = MyDate
Then in your datagrid use string formatting to display just the portion you want:
(You say your using a datagrid so I assume you're using .NET 1.1?)
<asp:BoundColum n DataField="Crea teDate" HeaderText="Dat e" DataFormatStrin g="{0:d}"> <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
Using the dataformat string you may display just the short date (lowercase "d") and just the short time (lowercase "t") of the datetime column.
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "yoshitha" <gu**********@y ahoo.co.in> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. hi
db : sql server 2000 lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
in my textbox date is in the format of 2/12/2006 and i'm inserting as it
is.
and time is in teh fromat of 10:30 and i'm inserting as it is.
but after retrieving and displaying in data grid it is diplsying the
filed 1 like this.
2/12/2006 12:00:00 AM
and field is displaying like this.
1/1/1900 12:00:00 PM
but i need data to be displayed in field 1 as 2/12/2006 and in field 2 as 10:30.
can anybody tell me how to do this. its very urgent for me.
thanx in advacne
yoshitha
Yoshitha,
Sure can!
Use uppercase "H" only for a 24-hour clock, and lowercase "h" only for a
12-hour clock. The AM/PM formats are replaced with "t" and "tt."
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"yoshitha" <gu**********@y ahoo.co.in> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl... i used the follwoing statement in data grid <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
then it is showing time in 12 hours format but i want to display it as 24 hours format. for eg in data base the data is stored as 18:30
and after using the above statement in the grid it is displaying 6:30 can you tell me how to display in 24 hours format? "S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in message news:ux******** *******@TK2MSFT NGP10.phx.gbl.. . Yoshitha,
You'll only need one field in the database. The database's DateTime field is always a combination of date and time. You should store your values as a single datetime (SQL Server 2005 was supposed to include separate date and time fields but they were removed from the final release....).
When you store your date and time in the server just combine them:
Dim MyDate As New DateTime([Year], [Month], [Day], [Hour], [Minute], [Seconds])
SqlCommand1.Par ameters.Add("@D ate", Data.SqlDbType. DateTime).Value = MyDate
Then in your datagrid use string formatting to display just the portion you want:
(You say your using a datagrid so I assume you're using .NET 1.1?)
<asp:BoundColum n DataField="Crea teDate" HeaderText="Dat e" DataFormatStrin g="{0:d}"> <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
Using the dataformat string you may display just the short date (lowercase "d") and just the short time (lowercase "t") of the datetime column.
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "yoshitha" <gu**********@y ahoo.co.in> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. hi
db : sql server 2000 lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
in my textbox date is in the format of 2/12/2006 and i'm inserting as it
is.
and time is in teh fromat of 10:30 and i'm inserting as it is.
but after retrieving and displaying in data grid it is diplsying the
filed 1 like this.
2/12/2006 12:00:00 AM
and field is displaying like this.
1/1/1900 12:00:00 PM
but i need data to be displayed in field 1 as 2/12/2006 and in field 2 as 10:30.
can anybody tell me how to do this. its very urgent for me.
thanx in advacne
yoshitha
thanx Justin, it isworking i just modified like this
DataFormatStrin g="{0:H:mm}", now it is showing the way i needed.
Regards
Yoshitha
"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in
message news:e7******** *****@TK2MSFTNG P12.phx.gbl... Yoshitha,
Sure can!
Use uppercase "H" only for a 24-hour clock, and lowercase "h" only for a 12-hour clock. The AM/PM formats are replaced with "t" and "tt."
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "yoshitha" <gu**********@y ahoo.co.in> wrote in message news:Oi******** ******@TK2MSFTN GP09.phx.gbl...i used the follwoing statement in data grid <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
then it is showing time in 12 hours format but i want to display it as 24 hours format. for eg in data base the data is stored as 18:30
and after using the above statement in the grid it is displaying 6:30 can you tell me how to display in 24 hours format? "S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in message news:ux******** *******@TK2MSFT NGP10.phx.gbl.. . Yoshitha,
You'll only need one field in the database. The database's DateTime field is always a combination of date and time. You should store your values as a single datetime (SQL Server 2005 was supposed to include separate date and time fields but they were removed from the final release....).
When you store your date and time in the server just combine them:
Dim MyDate As New DateTime([Year], [Month], [Day], [Hour], [Minute], [Seconds])
SqlCommand1.Par ameters.Add("@D ate", Data.SqlDbType. DateTime).Value = MyDate
Then in your datagrid use string formatting to display just the portion you want:
(You say your using a datagrid so I assume you're using .NET 1.1?)
<asp:BoundColum n DataField="Crea teDate" HeaderText="Dat e" DataFormatStrin g="{0:d}"> <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
Using the dataformat string you may display just the short date (lowercase "d") and just the short time (lowercase "t") of the datetime column.
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "yoshitha" <gu**********@y ahoo.co.in> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. hi
db : sql server 2000 lan : C#.net(ASp.Net)
in my database table there are 2 fileds of data type datatime.
in field 1 i'm storing date
in field 2 i'm storing time.
in my textbox date is in the format of 2/12/2006 and i'm inserting as it
is.
and time is in teh fromat of 10:30 and i'm inserting as it is.
but after retrieving and displaying in data grid it is diplsying the
filed 1 like this.
2/12/2006 12:00:00 AM
and field is displaying like this.
1/1/1900 12:00:00 PM
but i need data to be displayed in field 1 as 2/12/2006 and in field 2 as 10:30.
can anybody tell me how to do this. its very urgent for me.
thanx in advacne
yoshitha
Yoshitha,
Great!
Happy coding!
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"yoshitha" <gu**********@y ahoo.co.in> wrote in message
news:u1******** ******@TK2MSFTN GP12.phx.gbl... thanx Justin, it isworking i just modified like this DataFormatStrin g="{0:H:mm}", now it is showing the way i needed. Regards Yoshitha
"S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in message news:e7******** *****@TK2MSFTNG P12.phx.gbl... Yoshitha,
Sure can!
Use uppercase "H" only for a 24-hour clock, and lowercase "h" only for a 12-hour clock. The AM/PM formats are replaced with "t" and "tt."
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "yoshitha" <gu**********@y ahoo.co.in> wrote in message news:Oi******** ******@TK2MSFTN GP09.phx.gbl...i used the follwoing statement in data grid <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
then it is showing time in 12 hours format but i want to display it as 24 hours format. for eg in data base the data is stored as 18:30
and after using the above statement in the grid it is displaying 6:30 can you tell me how to display in 24 hours format? "S. Justin Gengo [MCP]" <justin@[no_spam_please]aboutfortunate. com> wrote in message news:ux******** *******@TK2MSFT NGP10.phx.gbl.. . Yoshitha,
You'll only need one field in the database. The database's DateTime field is always a combination of date and time. You should store your values as a single datetime (SQL Server 2005 was supposed to include separate date and time fields but they were removed from the final release....).
When you store your date and time in the server just combine them:
Dim MyDate As New DateTime([Year], [Month], [Day], [Hour], [Minute], [Seconds])
SqlCommand1.Par ameters.Add("@D ate", Data.SqlDbType. DateTime).Value = MyDate
Then in your datagrid use string formatting to display just the portion you want:
(You say your using a datagrid so I assume you're using .NET 1.1?)
<asp:BoundColum n DataField="Crea teDate" HeaderText="Dat e" DataFormatStrin g="{0:d}"> <asp:BoundColum n DataField="Crea teDate" HeaderText="Tim e" DataFormatStrin g="{0:t">
Using the dataformat string you may display just the short date (lowercase "d") and just the short time (lowercase "t") of the datetime column.
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "yoshitha" <gu**********@y ahoo.co.in> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. > hi > > db : sql server 2000 > lan : C#.net(ASp.Net) > > in my database table there are 2 fileds of data type datatime. > > in field 1 i'm storing date > > in field 2 i'm storing time. > > in my textbox date is in the format of 2/12/2006 and i'm inserting as > it > > is. > > and time is in teh fromat of 10:30 and i'm inserting as it is. > > but after retrieving and displaying in data grid it is diplsying the > > filed 1 like this. > > 2/12/2006 12:00:00 AM > > and field is displaying like this. > > 1/1/1900 12:00:00 PM > > > but i need data to be displayed in field 1 as 2/12/2006 > and in field 2 as 10:30. > > > can anybody tell me how to do this. its very urgent for me. > > > thanx in advacne > > yoshitha > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Laurence Neville |
last post by:
This is regarding a change in the Short Date format under Hebrew Regional
Settings, that has caused huge problems in our ASP web application. The
change appears to have been introduced sometime before Windows 2000 Service
Pack 4 and has remained through to Windows XP. I am looking for a solution
that doesn't involve rewriting our application (much) and that allows all
our users to keep using Hebrew Regional Settings.
To summarize our...
|
by: martini |
last post by:
Need help:
I am trying to call a DB2 stored procedure that requires parameters: 4x int,
date, varchar, int. I use VB6 & oledb.
I'm using statements:
cmd.CommandText = "{call db2admin.proc(1, 0, 3, 3, '2002-04-22', '0000000',
351)}"
and
cmd.CommandText = "{call db2admin.proc(1, 0, 3, 3, {d '2002-04-22'},
'0000000', 351)}"
and I get following error:
|
by: David B |
last post by:
I have 2 querys with the following in the date criteria
Between DateAdd("m",-6,(!!)) And
(!!)
Between DateAdd("m",-24,(!!)) And
DateAdd("m",-6,(!!))
Problem is they both look at the same day 6 months before the date entered. eg
date entered = 28/02/2004 then both querys pick up data from 28/08/2003
|
by: Dustin Wilson |
last post by:
I have a problem with the following line of code.
rstOutput! = FormatDateTime("January 1, 2004", vbLongDate)
When I run this on my computer at home it runs without problem but when I
run it at work I get a Run-time error '3421' Data type conversion error.
I'm really stumped as to why this is. Both computers are Windows 2000 SP4
with Access 2000. The field is a Date/Time field with a
format of Long Date set. Does anyone have an idea...
|
by: Lyn |
last post by:
Hi,
I am developing a project in which I am checking for records with
overlapping start/end dates. Record dates must not overlap date of birth,
date of death, be in the future, and must not overlap existing records from
the same table.
I had this all working some time ago, but recently when I have gone back to
do more testing, part of these validations no longer work. While there have
been changes to the code in the meantime, I cannot...
| |
by: Julie Wardlow |
last post by:
Help!
I am calculating a future date using the DateAdd function in a query (the
calculation also involves an IIf statement), and have managed to get this
formula to produce the required result.
I then want to search through the records and select those with dates (as
caluclated above) within a user defined range, and so I am using a parameter
query. However, this query returns dates outside of the range and appears to
have particular...
|
by: TN Bella |
last post by:
Hello,
I was looking through the older posts for a solution to this problem,
but I am still confused on how to fix my problem. There are two dates on
my form, one (txtInvDate) is entered by the user and has a validator
(reDate) attached for specific dates that can be entered. The second
date (txtRptDate) is another textbox that is filled with current date,
that can not be changed by the user. The date (txtRptDate) that cannot
be changed...
|
by: James P. |
last post by:
Hello there,
In my asp.net page using VB, I have a date text field in mm/dd/yyyy
format. When a date is entered, I'd like to validate it to make sure
the date is greater than or equal to the current date. If not, I'd
like to display the error message to ValidationSummary.
It seems to make sense to me to use CompareValidator but the problem
is put the current date into CompareValidator. So, I created a hidden
text field in my aspx. ...
|
by: Jim Armstrong |
last post by:
Hi all -
This problem has been driving me crazy, and I'm hoping the answer is
something stupid I am neglecting to see....
The procedure posted below is part of an Access/SQL database I have
developed. Basically, the user would input a beginning and ending date,
and the query goes and pulls records that meet the following criteria:
1. TradeDate is between beginning date and ending date
|
by: creative1 |
last post by:
Hello everyone.
I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this.
The problem is:
I want to print account statement (or any other report) from VB form based on an entered date in the masked fields (dd/mm/yy). I am using one form to display five reports. I send date to display report after formatting it (m/dd/yy). When I enter date range like this in masked textbox (DD/MM/YY)
...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |