...

View Full Version : Date and time question



Speedy
10-21-2003, 12:13 AM
Hi,

I wonder what code I should use instead of this:



<%=FormatDateTime(RecSet("Date"),2)%>


if I only want the date and not the time?

I tried this:

<%=FormatDate(RecSet("Date"),2)%>

but it didn't work :(

/Speedy

allida77
10-21-2003, 01:54 AM
Response.Write(Date())

whammy
10-21-2003, 03:38 AM
<% = Date() %>

(Same thing, just that <% = variable %> is a shortcut, if you're in the middle of HTML formatting)

Speedy
10-21-2003, 06:58 AM
Whammy.

this didn't work either:

<%=Date(RecSet("Date"),2)%>

I really need to get ried of the timestamp that I get with

<%=FormatDateTime(RecSet("Date"),2)%>

when it's saved to the database

/Speedy

whammy
10-21-2003, 02:44 PM
When it's saved to the database? Tried using SMALLDATETIME?

whammy
10-22-2003, 06:05 AM
P.S. I'm not sure what you mean... try this:

<% = FormatDateTime(Now(),2) %>

That just shows up as:

10/21/2003

Are you looking to only store this info in the database? I usually like to record a fairly specific time in the db (i.e. DATETIME in SQL Server) in case anything bad happens! You can always reformat it when you display it.

If you're using the above code, and it isn't working, please provide more details. :)

Speedy
10-22-2003, 10:17 PM
Thanks Whammy,

I got ot to work now, I just missed to change the code at
one spot in the code ;)

/S



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum