PC Review


Reply
Thread Tools Rate Thread

Convert DateTime.Now() to SQL Server(tm) standard internal format fordatetime

 
 
huohaodian@gmail.com
Guest
Posts: n/a
 
      6th Feb 2008
Hi,

How can I convert a value created from DateTime.Now() to the datetime
format that SQL Server recognises?


Thanks in advance.

 
Reply With Quote
 
 
 
 
BlackWasp
Guest
Posts: n/a
 
      6th Feb 2008
You could use .ToString() and provide format specifiers, such as

DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.ffffff")


--

BlackWasp
www.blackwasp.co.uk


<(E-Mail Removed)> wrote in message
news:900b5003-a554-47b9-b782-(E-Mail Removed)...
> Hi,
>
> How can I convert a value created from DateTime.Now() to the datetime
> format that SQL Server recognises?
>
>
> Thanks in advance.
>


 
Reply With Quote
 
BlackWasp
Guest
Posts: n/a
 
      6th Feb 2008
.....except use HH, not hh to get 24-hour clock times.

DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")

--

BlackWasp
www.blackwasp.co.uk


"BlackWasp" <nospam@please> wrote in message
news:%23Y$(E-Mail Removed)...
> You could use .ToString() and provide format specifiers, such as
>
> DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
>
>
> --
>
> BlackWasp
> www.blackwasp.co.uk
>
>
> <(E-Mail Removed)> wrote in message
> news:900b5003-a554-47b9-b782-(E-Mail Removed)...
>> Hi,
>>
>> How can I convert a value created from DateTime.Now() to the datetime
>> format that SQL Server recognises?
>>
>>
>> Thanks in advance.
>>

>


 
Reply With Quote
 
Jack Jackson
Guest
Posts: n/a
 
      7th Feb 2008
On Wed, 6 Feb 2008 10:43:49 -0800 (PST), (E-Mail Removed) wrote:

>Hi,
>
> How can I convert a value created from DateTime.Now() to the datetime
>format that SQL Server recognises?
>
>
> Thanks in advance.


You could supply the datetime as a parameter.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert DateTime.Now() to SQL Server(tm) standard internal format fordatetime huohaodian@gmail.com Microsoft C# .NET 4 6th Feb 2008 07:33 PM
Convert a latebinded DataTable column's format from DateTime to string (or format the date time value) RSH Microsoft VB .NET 0 6th Dec 2006 03:49 PM
convert datetime to sortable format pranesh.nayak@gmail.com Microsoft Dot NET Framework 5 27th Aug 2006 07:53 PM
Convert date() to DateTime format Ryan Ramsey Microsoft C# .NET 1 21st Jul 2006 07:47 AM
Any easy way to convert DateTime to Xml Date format Q. John Chen Microsoft C# .NET 2 8th Jul 2005 11:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:34 PM.