Solved

classic asp-DateAdd("h",4,now())

Posted on 2008-10-17
7
2,618 Views
Last Modified: 2012-05-05
i need to add 4 hours to the date and to print dd/mm/yyyy

help please
0
Comment
Question by:Sasha-N
[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
  • 4
  • 2
7 Comments
 
LVL 5

Expert Comment

by:nkoriginal
ID: 22741181
Try this..

<%=dateadd("h", 1, now())%>

Let me know any question

0
 
LVL 5

Assisted Solution

by:nkoriginal
nkoriginal earned 200 total points
ID: 22741191
For your case is

(here is with 4 hours more)

<%=dateadd("h", 4, now())%>
0
 
LVL 17

Assisted Solution

by:aflockhart
aflockhart earned 300 total points
ID: 22741255
<%
sDate = Now()
sNewDate = DateAdd("h", 4, sDate)
response.write(FormatDateTime(sNewDate ,2))
 
  %>

Option "2" in the FormatDateTime function chooses your local "short time " format. As long as that is set to dd/mm/yyyy on the server, that's what you'll get.

Otherwise, this longer version should work:

<%
sDate = Now()
  sNewDate = DateAdd("m", 1, sDate)
  response.write(day(sNewDate) & "/" & month(sNewDate) & "/" & year(sNewDate))
 
 %>
 



0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:nkoriginal
ID: 22741258
If you add this session

<%session.lcid=2057%>

you will see your date in DD/MM/YYYY

Here is en complete example


<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
 
<%session.lcid=2057%>
 
 
<html>
<head>
<title>Test</title>
</head>
 
<body>
 
<%=dateadd("h", 1, now())%>
 
</body>
</html>

Open in new window

0
 

Author Comment

by:Sasha-N
ID: 22741262
have you seen the title of my question?
0
 
LVL 17

Accepted Solution

by:
aflockhart earned 300 total points
ID: 22741270
sorry, second version should also add hours ...

<%
sDate = Now()
  sNewDate = DateAdd("h", 4, sDate)
  response.write(day(sNewDate) & "/" & month(sNewDate) & "/" & year(sNewDate))
 
 %>
0
 
LVL 5

Assisted Solution

by:nkoriginal
nkoriginal earned 200 total points
ID: 22741414
Do you try this

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
 
<%session.lcid=2057%>
 
 
<html>
<head>
<title>Test</title>
</head>
 
<body>
 
<%=dateadd("h", 1, now())%>
 
</body>
</html>
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Save ms data to server side. 19 59
MS SQL 2008 and stored prodcures and dates 5 27
Display field if column exists 7 35
SP converting date time to date and time separately 2 20
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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