DCPAus
asked on
Response.write Date - Format question
My server is set to English (Australian) the short format date is dd/MM/yyyy
the long Format is dddd, d MMMM,yyyy
Yet when I do a response.write Date it comes up as
mm/dd/yyyy
Why ?
Id there anyway that I can force the .write Date function to be dd/MM/yyyy or preferably dddd, d MMMM,yyyy.
I have also tried the following
sTestDate=formatdatetime(D ate,2)
response.write sTestDate
with no luck
Help would be appreciated
the long Format is dddd, d MMMM,yyyy
Yet when I do a response.write Date it comes up as
mm/dd/yyyy
Why ?
Id there anyway that I can force the .write Date function to be dd/MM/yyyy or preferably dddd, d MMMM,yyyy.
I have also tried the following
sTestDate=formatdatetime(D
response.write sTestDate
with no luck
Help would be appreciated
ASKER
Hoinang
Have you used this code before ?
I get the following error
Microsoft VBScript runtime (0x800A01B0)
File name or class name not found during Automation operation: 'RegExp'
/oncall/FormatDate.asp, line 120
Any ideas ?
Have you used this code before ?
I get the following error
Microsoft VBScript runtime (0x800A01B0)
File name or class name not found during Automation operation: 'RegExp'
/oncall/FormatDate.asp, line 120
Any ideas ?
ASKER
I found the following code not as complete as the code suggested by hoinang but adequate for my requirements
http://www.aspfree.com/authors/kevin_turner/datetime.asp
If anyone has some other suggestions I would love to see them
Thanks
DCPAus
http://www.aspfree.com/authors/kevin_turner/datetime.asp
If anyone has some other suggestions I would love to see them
Thanks
DCPAus
Hi DCP, try this:
<%
strDate = Day(Date) & "/" & Month(Date) & "/" & Year(Date)
Response.Write strDate
%>
Cheers,
Wakie.
<%
strDate = Day(Date) & "/" & Month(Date) & "/" & Year(Date)
Response.Write strDate
%>
Cheers,
Wakie.
sTestDate=formatdatetime(D ate,1)
ASKER
I duplicated this question.
The answer I acepted is
https://www.experts-exchange.com/questions/20524722/Response-write-Date-Format-question.html
The answer I acepted is
https://www.experts-exchange.com/questions/20524722/Response-write-Date-Format-question.html
Hi DCPAus,
I notice you gave the solution a grade of "B".
Is there any solutions in this question that have helped you more with your problem?
In my solution above, I use it myself as I also live in Australia. Have you tried it?
Regards,
Wakie.
I notice you gave the solution a grade of "B".
Is there any solutions in this question that have helped you more with your problem?
In my solution above, I use it myself as I also live in Australia. Have you tried it?
Regards,
Wakie.
ASKER
Hi Wakie
My problem related to more than just displaying the date in the correct format, but also dealing with the way I call and resave data into my dbase.
It is an issue that has been bugging me for weeks, and in essence none of the answers "solved" my problem - possibly I did not define it adequately, but some of them helped guide me in the write direction.
For instance your suggestion was one of my original solutions when I started the process.
I actually use a small dll written to the server that controls a variety of functions on my pages, and in it I have a function that does exactly that it extracts the day/month/year info and then rearranges it in whichever format I require.
So what I have now done is used the LCID info to control the date viewed data and I have "solved" - still nervous about it - the problem by ensuring that when I write/rewrite info to the database I encapsulate it in # # and so far - cross fingers it appears to be working.
I have read your member info, as well, and since you are an EE expert if you have any other advice to give me with regards to awarding and posting please feel free
Regards
DCP
My problem related to more than just displaying the date in the correct format, but also dealing with the way I call and resave data into my dbase.
It is an issue that has been bugging me for weeks, and in essence none of the answers "solved" my problem - possibly I did not define it adequately, but some of them helped guide me in the write direction.
For instance your suggestion was one of my original solutions when I started the process.
I actually use a small dll written to the server that controls a variety of functions on my pages, and in it I have a function that does exactly that it extracts the day/month/year info and then rearranges it in whichever format I require.
So what I have now done is used the LCID info to control the date viewed data and I have "solved" - still nervous about it - the problem by ensuring that when I write/rewrite info to the database I encapsulate it in # # and so far - cross fingers it appears to be working.
I have read your member info, as well, and since you are an EE expert if you have any other advice to give me with regards to awarding and posting please feel free
Regards
DCP
Hi DCP,
No problem there. I, personally, haven't tried any other solutions for my date/time formats other than what I suggested. I must admit, it took a long time to get it perfected. I've noticed the Day(Now) and Month(Now) commands often result in outputting the results back to front, especially when you use that method. It's a shame there isn't an easier way to personalise the dates for us Aussies :-)
I've actually written a pretty hand GMT converter - it converts the month/date to date/time and also allows you to personalise the time for your timezone. But, I won't ramble.
If you wish to claim a refund on your points for this question, you can post a zero-point question at Community Support (https://www.experts-exchange.com/Community_Support/).
Best of luck,
Wakie.
No problem there. I, personally, haven't tried any other solutions for my date/time formats other than what I suggested. I must admit, it took a long time to get it perfected. I've noticed the Day(Now) and Month(Now) commands often result in outputting the results back to front, especially when you use that method. It's a shame there isn't an easier way to personalise the dates for us Aussies :-)
I've actually written a pretty hand GMT converter - it converts the month/date to date/time and also allows you to personalise the time for your timezone. But, I won't ramble.
If you wish to claim a refund on your points for this question, you can post a zero-point question at Community Support (https://www.experts-exchange.com/Community_Support/).
Best of luck,
Wakie.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=7111