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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Feb 2014
    Posts
    188
    Thanks
    41
    Thanked 0 Times in 0 Posts

    Space in date field?

    Hello

    I have a date on a site (please see screenshot attached).

    To separate the ordinals, st, nd, rd, and th from the name of the month don't I just need to include a space in my script before the ampersand here: & MonthName(Month(local)) & "</p>"?

    Code:
    <%
    local = DateAdd( "h", 8, Now() )
    Dim suffix, local
    Select Case Day(local)
        Case 1,21,31: suffix = "st"
        Case 2,22: suffix = "nd"
        Case 3,23: suffix = "rd"
        Case Else: suffix = "th"
    End Select
    
    Response.Write "<p class=""show_date"">" & WeekdayName(Weekday(local)) _
                 & " " & Day(local) & "<sup>" & suffix & "</sup>" _
                 & MonthName(Month(local)) & "</p>"
    %>
    Thank you.
    Attached Thumbnails Attached Thumbnails Space in date field?-date_image.jpg  

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,603
    Thanks
    80
    Thanked 4,500 Times in 4,464 Posts
    Of course. But you could do that by just changing "</sup>" to include the space: "</sup>&nbsp;"

    You could use just a regular space, but the "&nbsp;" creates a "Non Breaking SPace", meaning that what follows the </sup> will always be on the same line on the screen.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Blue1 (09-14-2014)

  • #3
    Regular Coder
    Join Date
    Feb 2014
    Posts
    188
    Thanks
    41
    Thanked 0 Times in 0 Posts
    Thanks Old Pedant

    That looks better and tidier!

    Regards

    Blue


  •  

    Posting Permissions

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