How to show TODAY Date in a text line

tibi38 14 Dec, 2011
Hi,
try this:
<SCRIPT TYPE="text/javascript">
<!--
// SCRIPT FOR THE "TODAY"
function today()
{
var now,rv;
now = new Date();
var rv =
now.getMonth() + "/" +
now.getDate() + "/" +
now.getYear();
return rv;
}
// -->
</SCRIPT>
monak83 14 Dec, 2011
But in the HTML code where I shoult put the date? where I can see the date in my form?
tibi38 14 Dec, 2011
<SCRIPT TYPE="text/javascript">
<!--
// SCRIPT FOR THE "TODAY"
function today()
{
var now,rv;
now = new Date();
var rv =
now.getMonth() + "/" +
now.getDate() + "/" +
now.getYear();
return rv;
}

document.write(today());

// -->
</SCRIPT>
tibi38 14 Dec, 2011
<SCRIPT TYPE="text/javascript">
<!--
// SCRIPT FOR THE "TODAY"
function today()
{
var now,rv;
now = new Date();
var rv =
now.getMonth() + "/" +
now.getDate() + "/" +
now.getYear();
return rv;
}

document.write(today());

// -->
</SCRIPT>
GreyHead 15 Dec, 2011
Hi tibi38,

I'm sure you can do this in JavaScript but you don't need to.

Use a Custom Code action and add
<?php
echo date('m/d/Y');
?>

Bob
monak83 15 Dec, 2011
Hi Bob,
tanks so much for your reply but this is my problem:
I wolud show a message that tell to users that if they make an order today their order will arrive to they next 2 days.
So I should show the date of next 2 day, for example:
today is 15/12/2011 the message should show: "you order will be delivered 17/12/2011".

So I should incrase today date of more 2 days.
To do this is better javascript or php?

How can I do this?
Regards
monak83
monak83 15 Dec, 2011
Find:
<?php
echo date ('d/m/Y', strtotime ('+2 days'));
?> 


Another question:
the delivery date should not be Saturday or Sunday because aren't a working days.
So If +2 days date is saturday I should show +4 days and if +2 days date is sunday I should show +3 days.
Some help?

Regards

Is better javascript or php?
GreyHead 15 Dec, 2011
Hi monak83,

Hmm that's a very different question . . . I guess you are going to need to write some calendar code to work out when two 'business' days ahead is.

Normally you'd do this in PHP unless you need it to depend on data input by the user - it seems as though you don't in this case.

Bob
This topic is locked and no more replies can be posted.