Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date and time question

    Hi,

    I wonder what code I should use instead of this:

    Code:
    <%=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

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Response.Write(Date())
    does this sig match?

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <% = Date() %>

    (Same thing, just that <% = variable %> is a shortcut, if you're in the middle of HTML formatting)
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #4
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    When it's saved to the database? Tried using SMALLDATETIME?
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #7
    Regular Coder
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Whammy,

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

    /S


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •