Hi, All
Please, i need help with cast string to DateTime:
DateTime dt = new DateTime(2006,0 9,17); it works i can update Field in
Access DB
Next field is Short Time data type, how i can cast
string myTime = "13:30";
elena 2 13258
elena,
You can't cast, but you can convert.
Use the static Parse method on the TimeSpan class to convert this to a
TimeSpan instance. If you need that time to be for a specific date, then
you need to create a DateTime instance for the date that this time is on,
then add the time to that date and produce a new DateTime instance.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"elena" <el***@discussi ons.microsoft.c omwrote in message
news:15******** *************** ***********@mic rosoft.com...
Hi, All
Please, i need help with cast string to DateTime:
DateTime dt = new DateTime(2006,0 9,17); it works i can update Field in
Access DB
Next field is Short Time data type, how i can cast
string myTime = "13:30";
elena
Thank you, it works:
string td = "13:30";
cmd.Parameters. Add("@IsTime", OleDbType.DBTim e).Value = @TimeSpan.Parse (td);
"Nicholas Paldino [.NET/C# MVP]" wrote:
elena,
You can't cast, but you can convert.
Use the static Parse method on the TimeSpan class to convert this to a
TimeSpan instance. If you need that time to be for a specific date, then
you need to create a DateTime instance for the date that this time is on,
then add the time to that date and produce a new DateTime instance.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"elena" <el***@discussi ons.microsoft.c omwrote in message
news:15******** *************** ***********@mic rosoft.com...
Hi, All
Please, i need help with cast string to DateTime:
DateTime dt = new DateTime(2006,0 9,17); it works i can update Field in
Access DB
Next field is Short Time data type, how i can cast
string myTime = "13:30";
elena
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jguilford |
last post by:
I have created a SQL Stored Procedure that uses a Case statement to
determine the Order By. For one of the Case statements I am trying to
turn a Char field into Datetime in for the Order By, however I can not
get it to work. Can someone please take a look and my code below and
tell me what I am doing wrong. Thank you.
ORDER BY
CASE WHEN...
|
by: CA |
last post by:
Hi,
I have a function where I would like to test whether an object is of a
certain type. Here is my code so far.
public bool HasValidType(Type t, object val)
{
try
{
if (t==typeof(double))
|
by: Kevin |
last post by:
Hi All
I am having a problem retrieving a Date value from an
Access 2000 database using the OLEDbProvider. Can someone
tell me please how to create a DateTime Object with the
date fro m the Database, I need the database date to
subtract it from another date I have to gain the number
of days that have elapsed. I just cannot seem to get this...
|
by: simon |
last post by:
I declare variable as int16:
int16 hourS;
then I open dataReader and set the variable:
hourS=rdr.getInt16(1);
but I get an error when I start the page:
|
by: JenHu |
last post by:
Hi expert,
I have a data field (birthdate) contains a datetime datatype
(mm/dd/yyyy), how can I convert to mmdd??
say, the birthday is 8/1/1979 and convert to mmdd
DOB = DS.Tables("AcctInfoTble").Rows(3)("BRTHDATE")
strResult.Insert(12, DOB.PadLeft(37, " "))
...
| |
by: zafzal |
last post by:
Hello all,
I have a textbox in my asp.net (vb.net) aplicattion, I need to
assign it's value to a Variable of type DATE, but it's not a required
field, so sometimes I want to send a blank field.
I declared a variable as a date datatype and when it´s going to
receive
the content of the text field, it shows the following error "Cast from
|
by: Mike the Canadian |
last post by:
Suppose I have a MySQL 5 table with a DateTime field in it. The table
has two records where the time is blank. Running:
SELECT CAST(DateTimeField AS TIME) FROM MyTable
shows two records with NULL as the resultset. Running:
SELECT * FROM MyTable
WHERE CAST(DateTimeField AS TIME)=NULL
|
by: AMP |
last post by:
Hello,
I want to add some variables to a string and this isnt working.
textBox1.Text="'BSL version='+ bslVerHi+ bslVerLo";
What am I doing wrong?
Thanks
Mike
|
by: Terry |
last post by:
I have a TextBox with a date such as 15/01/2006 which I want to cast into a
variable as a short date 15/01/06, also
I need to cast a time such as 07:30 A.M. into a variable as a short time.
What is the best syntax for this please?
Regards
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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: 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...
| |