473,788 Members | 2,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date & Time Input

Hi,
I have two different text boxes. One is for reading user input date and the
other is for reading user input time.I'm using SQL 2005.
How can concatenate both of the two fields and send them as one data value
to be saved in a datetime field in the database?

Jan 17 '08 #1
4 5161
u can insert in table like this

'1/1/2001 12:00:00 AM'

month/day/year hour:minutes:se conds AM/PM

I do not know other format.

On Jan 17, 3:58*pm, "Tamer Ibrahim" <t.ge...@gmail. comwrote:
Hi,
I have two different text boxes. One is for reading user input date and the
other is for reading user input time.I'm using SQL 2005.
How can concatenate both of the two fields and send them as one data value
to be saved in a datetime field in the database?
Jan 17 '08 #2
"Tamer Ibrahim" <t.*****@gmail. comwrote in message
news:Oc******** ******@TK2MSFTN GP02.phx.gbl...
I have two different text boxes. One is for reading user input date and
the
other is for reading user input time.I'm using SQL 2005.
How can concatenate both of the two fields and send them as one data value
to be saved in a datetime field in the database?
If e.g. the first TextBox contained "17 Jul 2008" and the second contained
"08:15"

Convert.ToDateT ime(TextBox1.Te xt + " " + TextBox2.Text);
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 17 '08 #3
<zz*******@gmai l.comwrote in message
news:0f******** *************** ***********@e6g 2000prf.googleg roups.com...
You can insert in table like this

'1/1/2001 12:00:00 AM'
That it an ambiguous date format and should not be used...

E.g. '3/9/2001 12:00:00 AM" will be interpreted as either 3rd September or
9th March depending on the SQL Server settings and/or locale of the server
machine...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 17 '08 #4
I don't think it should be sent as string and parsed by SQL server, it's
safer to convert it to DateTime and passing as SqlDbType.DateT ime (4 byte
number) as you showed in your second reply.

Regards
--
Milosz
"Mark Rae [MVP]" wrote:
<zz*******@gmai l.comwrote in message
news:0f******** *************** ***********@e6g 2000prf.googleg roups.com...
You can insert in table like this

'1/1/2001 12:00:00 AM'

That it an ambiguous date format and should not be used...

E.g. '3/9/2001 12:00:00 AM" will be interpreted as either 3rd September or
9th March depending on the SQL Server settings and/or locale of the server
machine...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jan 18 '08 #5

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

Similar topics

1
2011
by: Gerry | last post by:
Help needed with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time 6 hours wrong. The time should be GMT minus 6 hours. Can anyone help me with that? Her's the code: <?php header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); ?>
4
2280
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time 6 hours wrong. The time should be GMT minus 6 hours. Can anyone help me with that? Her's the code: <?php header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");
9
2548
by: Shaiboy_UK | last post by:
Hi all, Hopefully something simple here. I have written a form that takes data from a text box and updates it into an Access database. However, I want to also pass the local user date and time using date() and time() JavaScript commands, but can't find the right syntax to put them in the input command, example: <input name=date value="<javascript command here">
3
6133
by: Agnes | last post by:
I know how to display Date only in the textbox . but How about the time ??? Can I put it into two separate textbox , but save in one datafield ? thanks a lot.
0
1134
by: Wladimir Mutel | last post by:
Hi, In our legacy asp/web-application, we have date/time-input form in USA style (i.e. mm/dd/yyyy and 12hour-scale time with AM/PM). There is also some validation code on client side, and then submitted data are used in MSSQL queries. Now I would like to know about how to generate locale-dependent HTML form layout, and what ready-made ASP code could I borrow for this task.
3
3101
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn =server.createobject("ADODB.connection") objConn.open "DSN=Photo" Dim sqlSELsite,ObjRSSel sqlSELsite = "SELECT Name FROM tblbwday WHERE B'day ="& date() &" " '
1
4147
by: aRTx | last post by:
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Artani <artan_p@msn.com>. www.artxcenter.com REQUIREMENTS ============ This script requires PHP and GD2 if you wish to use the
1
1849
by: adeebraza | last post by:
Hi, Every Body Following is code for Showing Actual Date & Time on the form and also record Date & Time of an event. See the following and use Call Modified when you want to record an event in your program. Option Explicit Dim Dt, Tm ' Timer set interval=1000 Private Sub Timer1_Timer()
3
5194
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
0
9656
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
9498
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,...
0
10366
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...
1
10112
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
9969
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
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.