If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Change date format

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-04, 22:35
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Change date format

I got this one prob about date in ASP.

If i want to display the date as from Wednesday, May 05, 2004 to
2004-05-05, how do i actually do that?
Thanx
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 22:56
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
I can't test this unfortunately but you might try.....

myDate = "Wednesday, May 05, 2004 "
myDay = day(myDate)
myMonth = Month(myDate)
myYear = year(myDate)
myNewDate = myYear & "-" & myMonth & "-" & myDay

You may have to change month and day to see if they need a 0 in front of them or not as well.
Reply With Quote
  #3 (permalink)  
Old 05-04-04, 23:05
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Sorry but it come out nothing.My code is like this:

mydate= ConvertDate(FormatDateTime(Date(), 1))
myday=Day(mydate)
mymonth=Month(mydate)
myyear=Year(mydate)
cutOffdate=myYear & "-" & myMonth & "-" & myDay
----------------------------------------------------------------
the output for the "ConvertDate(FormatDateTime(Date(), 1))"
is Wednesday, May 05, 2004.
Please help me
thanx
Reply With Quote
  #4 (permalink)  
Old 05-05-04, 02:14
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Are you actually using.... mydate= ConvertDate(FormatDateTime(Date(), 1))??

Because if you are.....

mydate= Date()
myday=Day(mydate)
mymonth=Month(mydate)
myyear=Year(mydate)
cutOffdate=myYear & "-" & myMonth & "-" & myDay

If you are stuck with this format Wednesday, May 05, 2004 then you might try this....
myDate = "Wednesday, May 05, 2004"
arrDate = split(myDate," ")
myDate = CDate(left(arrDate(2),2) & "-" & arrDate(1) & "-" & arrDate(3))
myday=Day(mydate)
mymonth=Month(mydate)
myyear=Year(mydate)
cutOffdate=myYear & "-" & myMonth & "-" & myDay
Reply With Quote
  #5 (permalink)  
Old 05-05-04, 02:37
michaelfg81 michaelfg81 is offline
Registered User
 
Join Date: Mar 2004
Posts: 202
Thanx very much.
I try and can already.
Thanx again
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On