I have 2 strings, "12/28/2005" and "16:44:54". I need to conatenate them and
convert them to datetime format so I can assign them to a datetime field in a
datarow. The time is now being converted to the date "12/28/2005". and I
don't know how to concatenate them since "+" won't work after I convert them.
Thanks, Alpha
if (result == "00")
{
char[] separator = {','};
char[] intSep = {'.'};
string lastDate, lastTime, lastMilleage;
DataRow drVeh = dsVehicle.Table s["VehDetail"].Rows[VListing.Curren tRowIndex];
DialogResult msgRet;
string[] replySeparated = ATSReply.Split( separator);
lastDate = replySeparated[2];
lastTime = replySeparated[3];
lastMilleage = replySeparated[4];
lastMilleage = lastMilleage.Su bstring(0, lastMilleage.Le ngth - 3);
string[] intLastMilleage = lastMilleage.Sp lit(intSep);
msgRet = MessageBox.Show ("Would you like to update the vehicle odometer to
" + lastMilleage +
" and the last odometer read date to " + lastDate + " and the read time to
" +
lastTime, "Live Update", MessageBoxButto ns.YesNo, MessageBoxIcon. Question);
if(msgRet == DialogResult.Ye s)
{
DateTime DatelastDate = Convert.ToDateT ime(lastDate);
DateTime TimeLastTime = Convert.ToDateT ime(lastTime);
// DateTime lastDateTime = DatelastDate + TimeLastTime;
drVeh["LastOdometerDa te"] = DatelastDate;
drVeh["LastOdometerRe ading"] = Convert.ToInt32 (intLastMilleag e[0]);
drVeh.EndEdit() ;
}
} 3 1452
Hi,
Sorry for the re-post ,check the DateTimeFormatI nfo class for build format
strings
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message
news:29******** *************** ***********@mic rosoft.com... I have 2 strings, "12/28/2005" and "16:44:54". I need to conatenate them and convert them to datetime format so I can assign them to a datetime field in a datarow. The time is now being converted to the date "12/28/2005". and I don't know how to concatenate them since "+" won't work after I convert them. Thanks, Alpha
if (result == "00") { char[] separator = {','}; char[] intSep = {'.'}; string lastDate, lastTime, lastMilleage; DataRow drVeh = dsVehicle.Table s["VehDetail"].Rows[VListing.Curren tRowIndex]; DialogResult msgRet;
string[] replySeparated = ATSReply.Split( separator); lastDate = replySeparated[2]; lastTime = replySeparated[3]; lastMilleage = replySeparated[4]; lastMilleage = lastMilleage.Su bstring(0, lastMilleage.Le ngth - 3); string[] intLastMilleage = lastMilleage.Sp lit(intSep);
msgRet = MessageBox.Show ("Would you like to update the vehicle odometer to " + lastMilleage + " and the last odometer read date to " + lastDate + " and the read time to " + lastTime, "Live Update", MessageBoxButto ns.YesNo, MessageBoxIcon. Question); if(msgRet == DialogResult.Ye s) { DateTime DatelastDate = Convert.ToDateT ime(lastDate); DateTime TimeLastTime = Convert.ToDateT ime(lastTime); // DateTime lastDateTime = DatelastDate + TimeLastTime;
drVeh["LastOdometerDa te"] = DatelastDate; drVeh["LastOdometerRe ading"] = Convert.ToInt32 (intLastMilleag e[0]); drVeh.EndEdit() ;
}
}
Hi,
You could use DateTime.ParseE xact( date_String + " " + time_String,
"MM/dd/yyyy HH:mm:ss, CultureInfo.Inv ariantCulture.D ateTimeFormat );
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message
news:29******** *************** ***********@mic rosoft.com... I have 2 strings, "12/28/2005" and "16:44:54". I need to conatenate them and convert them to datetime format so I can assign them to a datetime field in a datarow. The time is now being converted to the date "12/28/2005". and I don't know how to concatenate them since "+" won't work after I convert them. Thanks, Alpha
if (result == "00") { char[] separator = {','}; char[] intSep = {'.'}; string lastDate, lastTime, lastMilleage; DataRow drVeh = dsVehicle.Table s["VehDetail"].Rows[VListing.Curren tRowIndex]; DialogResult msgRet;
string[] replySeparated = ATSReply.Split( separator); lastDate = replySeparated[2]; lastTime = replySeparated[3]; lastMilleage = replySeparated[4]; lastMilleage = lastMilleage.Su bstring(0, lastMilleage.Le ngth - 3); string[] intLastMilleage = lastMilleage.Sp lit(intSep);
msgRet = MessageBox.Show ("Would you like to update the vehicle odometer to " + lastMilleage + " and the last odometer read date to " + lastDate + " and the read time to " + lastTime, "Live Update", MessageBoxButto ns.YesNo, MessageBoxIcon. Question); if(msgRet == DialogResult.Ye s) { DateTime DatelastDate = Convert.ToDateT ime(lastDate); DateTime TimeLastTime = Convert.ToDateT ime(lastTime); // DateTime lastDateTime = DatelastDate + TimeLastTime;
drVeh["LastOdometerDa te"] = DatelastDate; drVeh["LastOdometerRe ading"] = Convert.ToInt32 (intLastMilleag e[0]); drVeh.EndEdit() ;
}
}
Thank you Ignacio. That worked out great!
Alpha
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
You could use DateTime.ParseE xact( date_String + " " + time_String, "MM/dd/yyyy HH:mm:ss, CultureInfo.Inv ariantCulture.D ateTimeFormat );
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message news:29******** *************** ***********@mic rosoft.com...I have 2 strings, "12/28/2005" and "16:44:54". I need to conatenate them and convert them to datetime format so I can assign them to a datetime field in a datarow. The time is now being converted to the date "12/28/2005". and I don't know how to concatenate them since "+" won't work after I convert them. Thanks, Alpha
if (result == "00") { char[] separator = {','}; char[] intSep = {'.'}; string lastDate, lastTime, lastMilleage; DataRow drVeh = dsVehicle.Table s["VehDetail"].Rows[VListing.Curren tRowIndex]; DialogResult msgRet;
string[] replySeparated = ATSReply.Split( separator); lastDate = replySeparated[2]; lastTime = replySeparated[3]; lastMilleage = replySeparated[4]; lastMilleage = lastMilleage.Su bstring(0, lastMilleage.Le ngth - 3); string[] intLastMilleage = lastMilleage.Sp lit(intSep);
msgRet = MessageBox.Show ("Would you like to update the vehicle odometer to " + lastMilleage + " and the last odometer read date to " + lastDate + " and the read time to " + lastTime, "Live Update", MessageBoxButto ns.YesNo, MessageBoxIcon. Question); if(msgRet == DialogResult.Ye s) { DateTime DatelastDate = Convert.ToDateT ime(lastDate); DateTime TimeLastTime = Convert.ToDateT ime(lastTime); // DateTime lastDateTime = DatelastDate + TimeLastTime;
drVeh["LastOdometerDa te"] = DatelastDate; drVeh["LastOdometerRe ading"] = Convert.ToInt32 (intLastMilleag e[0]); drVeh.EndEdit() ;
}
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: php newbie |
last post by:
Hello,
I am trying to insert some date values into a table. I am using ODBC
prepared statements to (potentially) improve performance. The
statement syntax I am using is this:
INSERT INTO date_tests (date_col) VALUES ( CONVERT(DATETIME, ?, 121) )
The table is defined as "CREATE TABLE date_tests (date_col DATETIME)".
Then, I call this...
|
by: Kim Hellan |
last post by:
I have a simple string in the format "DD-MM-YY hh:mm:ss", that I need to
convert to a DateTime value.
I know this is a standard problem, but please don't just link to all the
MSDN pages regarding Parse() and ParseExact().
I've been there and read all the information about using IFormatProviders,
DateTimeStyles, CultureInfo.......
Bottom...
|
by: NateM |
last post by:
How do I convert any given date into a milliseconds value that
represents the number of milliseconds that have passed since January 1,
1970 00:00:00.000 GMT?
Is there an easy way to do this like Date in java?
Thanks,
Nate
|
by: Dixie |
last post by:
I am trying to calculate the number of workdays between two dates with
regards to holidays as well. I have used Arvin Meyer's code on the Access
Web, but as I am in Australia and my date format is dd/mm/yyyy, I have found
that the dates I put in my holidays table are reversed into American dates.
So, the wrong holiday dates are subtracted...
|
by: Alok yadav |
last post by:
i am using a webservice in which a method is serach. i use this method
which accept a argument of date type in dd/MM/yyyy formate. i have a
textbox which accept the date from the user, when i convert textbox data
into Datatime formate it converted into MM/dd/yyyy formate, but i have a
requirement in dd/MM/yyyy formate.
please help me, i am...
| |
by: gs |
last post by:
let say I have to deal with various date format and I am give format string
from one of the following
dd/mm/yyyy
mm/dd/yyyy
dd/mmm/yyyy
mmm/dd/yyyy
dd/mm/yy
mm/dd/yy
dd/mmm/yy
mmm/dd/yy
|
by: helpwithcode |
last post by:
Hi people,
I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements,
String string_dob=text_dob.getText();
//Converting string to date
System.out.println(string_dob);
s.Info_DOB=Date.valueOf(string_dob);
runs perfectly fine in the method insert() and throws up an...
|
by: rob41 |
last post by:
I'm in the process of converting numerous queries from access 07 to sql server 05 to improve runtime performance. Below is a sample of code and the error I'm getting.
INSERT INTO
( , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , )
SELECT ., ., ., LTrim(.) AS Expr1, LTrim(.) AS ,...
|
by: matheussousuke |
last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails.
The goal is: Make it send the email with the URL http://mghospedagem.com/images/controlpanel.jpg
instead of
http://mghospedagem.comhttp://mghospedagem.com/images/controlpanel.jpg
As u see, there's the...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |