Date problem

Results 1 to 6 of 6

Thread: Date problem

  1. #1
    Karuna Guest

    Default Date problem

    Hi I am trying to get date from the system in my asp application.<BR>I did like this.<BR><BR>formatdatetime(now(),vbshortdate).<BR >Its returning date like this 5/16/2001, but I need date like<BR>05/16/2001. We set the reasonal settings properly. But still<BR>I am not getting date as I required. I tried concatenating &#039;0&#039;,<BR>but not working. Could anybody please tell me how can I get the date in my required format? Thanks.

  2. #2
    Join Date
    Dec 1969

    Default Bit clunky but...

    Try this<BR><BR>document.write right("00" & datepart("D",now()),2) & "/" &right("00" & datepart("m",now()),2) & "/" &right("00" & datepart("y",now()),2)<BR>

  3. #3
    danscan Guest

    Default here is Bass Ackwards way but should work.

    if len(month(date)) &#060; 2 then<BR> strmonth= "0" + month(date)<BR>else<BR> strmonth = month(date)<BR>end if<BR>&#039;Do something similiar for day.<BR>strday = day(date)<BR><BR>strDate = strmonth + strday +year(date)

  4. #4
    Join Date
    Dec 1969

    Default need to..

    You&#039;d need to check both Month and Day for Len()&#060;2

  5. #5
    Join Date
    Dec 1969

    Default kool..

    So you always add leading 0s but only us 2 characturs... it workd

  6. #6
    karuna Guest

    Default RE: Bit clunky but...

    Thanks. Its working.

Posting Permissions

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