473,320 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

reformat current DateTime object

Hi All

I have a DateTime object called dt. the format of dt.Date
is mm/dd/yyyy. How can I change this format to dd/mm/yyyy
and still keep it as a DateTime object so that I can run
this following SQL query :

UPDATE WorkRoster SET DateWorking = ? WHERE DateWorking IS
NULL

I have added a parameter to hold the date.

I have tried to make my parameter = dt.ToString("d"), but
when the Update statment runs I get and OLEDbException
that is thrown, telling me that the Paramter does not have
a default value. I assuming it's maybe telling me this
because I tried to enter a string in the parameter?

The database is an Access 2000 DB and the field's datatype
is ShortDate.

How can I solve this problem?

Any help is much appreciated
TIA
Kevin
Nov 15 '05 #1
1 1458
Kevin <an*******@discussions.microsoft.com> wrote:
I have a DateTime object called dt. the format of dt.Date
is mm/dd/yyyy.
No it's not. Not really. The format of dt.Date is another DateTime.
DateTimes themselves have no explicit format.
How can I change this format to dd/mm/yyyy
and still keep it as a DateTime object so that I can run
this following SQL query :

UPDATE WorkRoster SET DateWorking = ? WHERE DateWorking IS
NULL

I have added a parameter to hold the date.


In that case just set the value to dt.Date, which is a DateTime itself
- there's no need to format it at all.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

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

Similar topics

1
by: Sam Collett | last post by:
I have the following that lists *.doc files in a folder. How do I list other types as well (I have tried using dirInfo.GetFiles("*.doc;*.rtf;*.pdf") but it does not work)? <%@ Import...
5
by: Jim Heavey | last post by:
2 questions... The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it. If you declare a field as a DateTime, but...
2
by: Francois Malgreve | last post by:
hello guys, I have some helper class in my ASP.NET pplication who basically contains static methods. I used them as helper methods to do small jobs that I can use at many places in my code. ...
0
by: Ben | last post by:
module main ... application.run(new splashform) .. end module after a few screen, I try to load a new codes I got from MSDN on datagrid that works on its own. I took out submain and ran...
2
by: markryde | last post by:
Hello, I am trying to add the current date to a file name in python script like thus: import os import sys import rpm import time import datetime
2
by: Kondapanaidu | last post by:
Hi, I am with C#(V1.1). How to add only minutes to a current system time in C#. Suppose My system time is 16:28:09.28(Type time at command prompt) I need to add 1 minute to a this time :
4
by: iwdu15 | last post by:
Hi, in VB i could use the keyword Now to get the current DateTime, but C# doesnt have that. How can i get the current time? thanks -- -iwdu15
5
by: soni2926 | last post by:
Hi, I have a web application, asp.net and c# done in 2.0, which is going to return rows from the db with dates or certain events. The db is going to have events dates for the entire year, but on...
5
by: Aljosa Mohorovic | last post by:
i use this to find out current week and total number of weeks for current year: now = datetime.now() weeks_in_year = int(date(now.year, 12, 31).strftime("%W")) current_week = int(date(now.year,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.