Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    function remove datetime semicolon (ASP)

    Hi
    Im looking for code function to remove semicolon for time
    strdatetime = format(Time, "hhmmss")
    I failed for above function as it is not supported for ASP script.
    i wonder anyone can guide ASP script function for getting current date time with ddmmyyyy_hhmmmss

    Thanks

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: function remove datetime semicolon (ASP)

    Have you tried something like:
    <code>strDateTime = DateTime.Now.ToString("ddmmyyyy_hhmmss")</code>?
    HTH
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Lounger
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: function remove datetime semicolon (ASP)

    Hi
    It not work with error below. Im actually just written using ASP script not ASP.NET .
    Error Type:
    Microsoft VBScript runtime (0x800A01A8)
    Object required: 'DateTime'
    /asplogin/main.asp, line 20

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: function remove datetime semicolon (ASP)

    Welcome to Woody's Lounge!

    You posted your request in the .NET forum. Rory's reply assumed you were using .NET. It appears that you are not.

    Try this: Day(Now) & Month(Now) & Year(Now) & "_" & Hour(Now) & Minute(Now) & Second(Now)

  5. #5
    Lounger
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: function remove datetime semicolon (ASP)

    Hi All,
    Really thanks alots..it solved my problem.
    thanks mark and rory.

    Sorry for the confusion...about posting at .net site.

    Thanks again..
    Gan

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: function remove datetime semicolon (ASP)

    Glad it works!

    The one thing I didn't mention before is that the values are not padded as 2 digits. You may need to add some logic to pad with "0"s if the values are less than 2 characters long. I'm not sure what your business needs are in this case.

    For instance, you'll get things like 3152006_1125, but you may actually want it to look like 03152005_010125.

    Post back if you have any trouble making this work.

Posting Permissions

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