Ask a Question related to ASP Database, Design and Development.
-
Girish #1
retrieving date from sqlserver
I have date in this form stored in sqlserver 2004-01-29 10:24:41.000, when I
retrive it using formatdatetime vb function I get output as 12/30/99..
Any ideas please...
Girish Guest
-
Switch from SqlServer
We do a lot of ETL using DTS. I'm new to Mysql and wonder what options it has to perform these tasks. The data is extracted from the host system to... -
[Macromedia][SQLServer JDBC Driver][SQLServer]Internal
I'm running an export process which takes data and dumps it to a text file. The query used to build it can contain large amounts of information in... -
Win32::SqlServer 2.001
Two weeks ago I announced MSSQL::OlleDB 2.000. That name was not popular with the people on the Perl module list (since the module is Windows-only),... -
Connecting ASP.NET to SQLServer,Somebody,Please!!
It is now 3 months that we are trying to connect ASP.NET to a SQLServer located on another system However we act,we get a fatal error We need... -
Adapt date from Oracle to SQLServer
Aaron Bertrand - MVP wrote: Thnaks a lot, I'll adapt the function. Good Idea :) -- Direct access to this group with http://web2news.com... -
Bob Barrows #2
Re: retrieving date from sqlserver
Girish wrote:
No. Unless you are storing it in a char or varchar column, it is NOT stored> I have date in this form stored in sqlserver 2004-01-29 10:24:41.000,
in this form. Datetimes are stored as paired integers, the first containing
the number of days since the seed date, and the second containing the number
of milliseconds since midnight. All formatting is done by the client
application which displays the date
Show us the code.> when I retrive it using formatdatetime vb function I get output as
> 12/30/99..
>
> Any ideas please...
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows Guest
-
Bob Barrows #3
Re: retrieving date from sqlserver
Girish wrote:
Actually, ignore my last post: don't show us the code. Instead, go to> I have date in this form stored in sqlserver 2004-01-29 10:24:41.000,
> when I retrive it using formatdatetime vb function I get output as
> 12/30/99..
>
> Any ideas please...
[url]www.aspfaq.com[/url] and search for "date". You will find several articles about
using dates.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows Guest
-
Jeff Cochran #4
Re: retrieving date from sqlserver
On Thu, 29 Jan 2004 12:36:41 -0800, "Girish" <girishkiss@yahoo.com>
wrote:
Is it a Date/Time data type in SQL? Or a text field? Are you sure>I have date in this form stored in sqlserver 2004-01-29 10:24:41.000, when I
>retrive it using formatdatetime vb function I get output as 12/30/99..
you have the correct FormatDateTime syntax? Show the code snippet,
and/or check:
[url]http://www.devguru.com/Technologies/vbscript/quickref/formatdatetime.html[/url]
Jeff
Jeff Cochran Guest
-
Girish #5
Re: retrieving date from sqlserver
It is smalldatetime DATA TYPE, in one scenario I just want date and the
other both date and time in one shot, I followed your URL there you are
passing either date or time where as me I am passing both so.....
"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
news:403078e7.30692773@msnews.microsoft.com...when I> On Thu, 29 Jan 2004 12:36:41 -0800, "Girish" <girishkiss@yahoo.com>
> wrote:
>> >I have date in this form stored in sqlserver 2004-01-29 10:24:41.000,>> >retrive it using formatdatetime vb function I get output as 12/30/99..
> Is it a Date/Time data type in SQL? Or a text field? Are you sure
> you have the correct FormatDateTime syntax? Show the code snippet,
> and/or check:
>
> [url]http://www.devguru.com/Technologies/vbscript/quickref/formatdatetime.html[/url]
>
> Jeff
Girish Guest
-
Jeff Cochran #6
Re: retrieving date from sqlserver
On Thu, 29 Jan 2004 14:02:42 -0800, "Girish" <girishkiss@yahoo.com>
wrote:
So.... What?>It is smalldatetime DATA TYPE, in one scenario I just want date and the
>other both date and time in one shot, I followed your URL there you are
>passing either date or time where as me I am passing both so.....
You're not "passing" anything, you're retrieving a field in a record
from your database and formatting what you retrieve. Try something
like:
SelectedDate = SELECT MyDateField FROM TableWithDateField
MyDate = FormatDateTime(SelectedDate,0)
Response.Write MyDate
Or...
SelectedDate = SELECT MyDateField FROM TableWithDateField
MyDate = FormatDateTime(SelectedDate,2)
MyTime = FormatDateTime(SelectedDate,3)
Response.Write MyDate & " " & MyTime
You get the idea. You'll need to tweak the SQL for your own database
and connection of course.
And read the ASPFAQ items suggested by Ray for other trickery with
dates and times.
Jeff
>"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
>news:403078e7.30692773@msnews.microsoft.com...>when I>> On Thu, 29 Jan 2004 12:36:41 -0800, "Girish" <girishkiss@yahoo.com>
>> wrote:
>>>> >I have date in this form stored in sqlserver 2004-01-29 10:24:41.000,>>>>> >retrive it using formatdatetime vb function I get output as 12/30/99..
>> Is it a Date/Time data type in SQL? Or a text field? Are you sure
>> you have the correct FormatDateTime syntax? Show the code snippet,
>> and/or check:
>>
>> [url]http://www.devguru.com/Technologies/vbscript/quickref/formatdatetime.html[/url]
>>
>> JeffJeff Cochran Guest
-
John Blessing #7
Re: retrieving date from sqlserver
> SelectedDate = SELECT MyDateField FROM TableWithDateField
Huh? And there i was thinking you might need a connection object or even a> MyDate = FormatDateTime(SelectedDate,0)
> Response.Write MyDate
recordset <g>
--
John Blessing
[url]http://www.LbeHelpdesk.com[/url] - Help Desk software priced to suit all
businesses
[url]http://www.free-helpdesk.com[/url] - Completely free help desk software !
[url]http://www.lbetoolbox.com[/url] - Remove Duplicates from MS Outlook
"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
news:4038863d.34106993@msnews.microsoft.com...[url]http://www.devguru.com/Technologies/vbscript/quickref/formatdatetime.html[/url]> On Thu, 29 Jan 2004 14:02:42 -0800, "Girish" <girishkiss@yahoo.com>
> wrote:
>>> >It is smalldatetime DATA TYPE, in one scenario I just want date and the
> >other both date and time in one shot, I followed your URL there you are
> >passing either date or time where as me I am passing both so.....
> So.... What?
>
> You're not "passing" anything, you're retrieving a field in a record
> from your database and formatting what you retrieve. Try something
> like:
>
> SelectedDate = SELECT MyDateField FROM TableWithDateField
> MyDate = FormatDateTime(SelectedDate,0)
> Response.Write MyDate
>
> Or...
>
> SelectedDate = SELECT MyDateField FROM TableWithDateField
> MyDate = FormatDateTime(SelectedDate,2)
> MyTime = FormatDateTime(SelectedDate,3)
> Response.Write MyDate & " " & MyTime
>
> You get the idea. You'll need to tweak the SQL for your own database
> and connection of course.
>
> And read the ASPFAQ items suggested by Ray for other trickery with
> dates and times.
>
> Jeff
>> >"Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
> >news:403078e7.30692773@msnews.microsoft.com...> >when I> >> On Thu, 29 Jan 2004 12:36:41 -0800, "Girish" <girishkiss@yahoo.com>
> >> wrote:
> >>
> >> >I have date in this form stored in sqlserver 2004-01-29 10:24:41.000,> >> >retrive it using formatdatetime vb function I get output as 12/30/99..
> >>
> >> Is it a Date/Time data type in SQL? Or a text field? Are you sure
> >> you have the correct FormatDateTime syntax? Show the code snippet,
> >> and/or check:
> >>
> >>>> >> >>
> >> Jeff
John Blessing Guest
-
Jeff Cochran #8
Re: retrieving date from sqlserver
On Thu, 29 Jan 2004 22:50:17 -0000, "John Blessing"
<jb@**REMOVE**THIS**LbeHelpdesk.com> wrote:
Probably the reason I posted this line as well:>>> SelectedDate = SELECT MyDateField FROM TableWithDateField
>> MyDate = FormatDateTime(SelectedDate,0)
>> Response.Write MyDate
>Huh? And there i was thinking you might need a connection object or even a
>recordset <g>
If someone needs me to write the entire page I'll be happy to when I> You get the idea. You'll need to tweak the SQL for your own database
> and connection of course.
get the time, or when I get my usually exhorbitant fee... :)
Jeff
Jeff Cochran Guest



Reply With Quote

