473,397 Members | 1,950 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,397 software developers and data experts.

Sql Server Datetime

Hello Everyone,

I am trying to pull back value from my database and the value in the field
is 2004-10-16 16:48:36.840

but when I store that in a string variable it gets converted into real time
10/16/2004 4:48:36PM

I want to keep the value as is and not have it converted, so I tried to use
the format function
Format(oEncRow.Item(2), "yyyy-mm-dd h:mm:ss.fff")

and this is what is returned from the above function

2004-48-16 4:48:36.840
Anyone have any ideas on how I can keep this value as it is stored in the
database
--
JD

Nov 18 '05 #1
2 1074
First off, the way it is stored in the database is a date. When you see it
in query analyzer or whatever, it is just some predefined conversion to a
string.

You need to look up formatting strings for datetime. 'm' is for minutes
that don't have a leading zero - you are using it in the month placeholder.
You need to use 'M' instead (or 'MM' for month with leading zeros).

Also, you can use 'H' for a 24 hr format for hours without leading zeros (or
'HH' with leading zeros).

"Irishmaninusa"
<jd***@structuctureinteractive.com.takemeoffifyouw antoemailme> wrote in
message news:ud**************@tk2msftngp13.phx.gbl...
Hello Everyone,

I am trying to pull back value from my database and the value in the field
is 2004-10-16 16:48:36.840

but when I store that in a string variable it gets converted into real time 10/16/2004 4:48:36PM

I want to keep the value as is and not have it converted, so I tried to use the format function
Format(oEncRow.Item(2), "yyyy-mm-dd h:mm:ss.fff")

and this is what is returned from the above function

2004-48-16 4:48:36.840
Anyone have any ideas on how I can keep this value as it is stored in the
database
--
JD

Nov 18 '05 #2
You can minutes instead of month. Use capital M. And look in "Custom
DateTime Format Strings" topic in the help.

Eliyahu

"Irishmaninusa"
<jd***@structuctureinteractive.com.takemeoffifyouw antoemailme> wrote in
message news:ud**************@tk2msftngp13.phx.gbl...
Hello Everyone,

I am trying to pull back value from my database and the value in the field
is 2004-10-16 16:48:36.840

but when I store that in a string variable it gets converted into real time 10/16/2004 4:48:36PM

I want to keep the value as is and not have it converted, so I tried to use the format function
Format(oEncRow.Item(2), "yyyy-mm-dd h:mm:ss.fff")

and this is what is returned from the above function

2004-48-16 4:48:36.840
Anyone have any ideas on how I can keep this value as it is stored in the
database
--
JD

Nov 18 '05 #3

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

Similar topics

5
by: sandman | last post by:
I've been testing my web app on another workstation to simulate using the server time. The test pc's time is an hour behind the server time and when the user processes a request, the server time...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
5
by: Grigs | last post by:
Hello, I have a project that contains a WebService that works great when connecting to it on my Localhost. Once we post the files to the test web server, all of the pages that do not touch the...
0
by: kolalakitty | last post by:
Hopefully someone here can help me/point me in the right direction. I've found tons of references towards making relations, creating rows, saving said rows, using datagrids, databinding objects,...
10
by: Henrik Dahl | last post by:
Hello! I have an xml schema which has a date typed attribute. I have used xsd.exe to create a class library for XmlSerializer. The result of XmlSerializer.Serialize(...) should be passed as the...
4
by: Manikandan | last post by:
Hi, I'm inserting a datetime values into sql server 2000 from c# SQL server table details Table name:date_test columnname datatype No int date_t DateTime ...
3
by: huohaodian | last post by:
Hi, How can I convert a value created from DateTime.Now() to the datetime format that SQL Server recognises? Thanks in advance.
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
jinu1996
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...
0
agi2029
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,...

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.