?
Solved

ASP "Get Date" from Browser Code

Posted on 2003-03-03
9
Medium Priority
?
653 Views
Last Modified: 2009-07-29
How can I format the text of this asp script to specify script & other text properties.

<%
          curdate = Now
          If IsDate(curdate) Then pDate = FormatDateTime(curDate, 1)
          response.write pDate
      %>
0
Comment
Question by:technick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8059292
do you mean format the output text ?  you can do this by including html tags in the output as follows.

<%
         curdate = Now
         If IsDate(curdate) Then pDate = FormatDateTime(curDate, 1)
         response.write ("<FONT COLOR=""RED"">" & pDate & "<FONT>")
%>

If this isnt what you mean then please explain further.
0
 
LVL 1

Author Comment

by:technick
ID: 8060721
So I could do it like this?

<%
        curdate = Now
        If IsDate(curdate) Then pDate = FormatDateTime(curDate, 1)
        response.write ("<FONT COLOR=""WHITE"">" & pDate & "<NEW TIMES ROMAN>")
%>
0
 
LVL 1

Expert Comment

by:NicolNghia
ID: 8062573
Hi technick,

No, you can do as below:

<%
       curdate = Now
       If IsDate(curdate) Then pDate = FormatDateTime(curDate, 1)
       response.write ("<FONT style="BACKGROUND-COLOR: lightgoldenrodyellow" color=mediumvioletred>  face='Lucida Console'" & pDate & "</FONT>")'Replace 'Lucida Console' with the font you want
%>


Note that, in case you use 'Times New Roman', you don't need to specify the 'face' attribute, because this is default font name. And the code as below:

       response.write ("<FONT style="BACKGROUND-COLOR: lightgoldenrodyellow" color=mediumvioletred>" & pDate & "</FONT>")


good luck,
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 4

Expert Comment

by:Jigit
ID: 8065251
Unfortunately, this
  response.write ("<FONT style="BACKGROUND-COLOR: lightgoldenrodyellow" color=mediumvioletred>" & pDate & "</FONT>")

won't work. You cannot put " inside a string in this way. You can put them twice or replace them with ', as shown below:

  Response.Write ("<FONT style=""BACKGROUND-COLOR: lightgoldenrodyellow"" color=mediumvioletred>" & pDate & "</FONT>")

OR

  Response.Write ("<FONT style='BACKGROUND-COLOR: lightgoldenrodyellow' color=mediumvioletred>" & pDate & "</FONT>")

HTH,
Jigit
0
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8070605
here is the syntax for what you asked to do.

<%
       curdate = Now
       If IsDate(curdate) Then pDate = FormatDateTime(curDate, 1)
       response.write ("<FONT COLOR=""WHITE"" FACE=""TIMES NEW ROMAN"">" & pDate</FONT>")
%>
0
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8070607
here is the syntax for what you asked to do.

<%
       curdate = Now
       If IsDate(curdate) Then pDate = FormatDateTime(curDate, 1)
       response.write ("<FONT COLOR=""WHITE"" FACE=""TIMES NEW ROMAN"">" & pDate & "</FONT>")
%>
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 10463249
PAQed - no points refunded (of 100)

GhostMod
Community Support Moderator
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question