#1
  1. No Profile Picture
    Contributing User
    ASP Discoverer (100 - 499 posts)

    Join Date
    Dec 2005
    Posts
    261
    Rep Power
    13

    Local Date in VB.NET


    Hello

    What is the best way, please, of generating the current, local ordinal date (without the time) on an aspx page? At the moment, I have:

    Code:
    Public Function ToString
    Dim dateOnly As Date
     Console.WriteLine(dateOnly.ToString("MMMM dd, yyyy") + ".")
    
    Dim suffix, local
    local = DateAdd( "h", 8, Now() )
    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
    
    End Function
    I know that is incorrect, but possibly on the right lines?

    Thanks for any help.

    Steve
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Aug 2008
    Location
    USA
    Posts
    1,606
    Rep Power
    348
    Hey,

    If i'm correct with your requirement , we have DateTime.ToLocalTime Method in C# you may use that.

    DateTime.ToLocalTime Method (System)
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

    Jquery Shake Effect ,
    Andriod KitKat


    Thank You,
    KiranK

Similar Threads

  1. Knowing if a local user belongs to a specific local group
    By balubeto in forum Windows Scripting
    Replies: 1
    Last Post: September 15th, 2010, 01:20 AM
  2. System Date from Server or Local PC
    By ryanlcs in forum ASP Development
    Replies: 1
    Last Post: February 28th, 2007, 10:50 PM
  3. Local date with time
    By ceema in forum HTML, JavaScript And CSS Help
    Replies: 6
    Last Post: February 12th, 2007, 11:28 AM
  4. Formating local date problem,
    By UniLeo in forum Microsoft Access Help
    Replies: 1
    Last Post: December 1st, 2004, 08:42 AM
  5. How to show local time and date
    By szms in forum HTML, JavaScript And CSS Help
    Replies: 2
    Last Post: August 3rd, 2004, 03:36 PM

IMN logo majestic logo threadwatch logo seochat tools logo