Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Display day of the week

Posted 02 May 2002 16:52:35
1
has voted
02 May 2002 16:52:35 David Behan posted:
Programming: asp and vbscript

This may be a very simple question but I need the code to display what day of the week it is today, what it was yesterday and what it is tomorrow. Any suggestions?

I have it laid out in the format 02/05/2002 with
02 being its own variable,
05 being its own variable and
2002 being its own variable

for each of today, tomorrow and yesterday. Now my client wants to change the date format to Thursday 2 May 2002. I can do all the formatting for day of the month, month name and year but I am stuck on the displaying the day "name".

Any suggestions?

Thanks

_________________________
David Behan - www.bmor.com

Edited by - beano on 02 May 2002 16:57:50

Replies

Replied 02 May 2002 17:16:48
02 May 2002 17:16:48 David Behan replied:
got it using ultradev DoDateTime function... so all ok now.

_________________________
David Behan - www.bmor.com
Replied 02 May 2002 17:33:08
02 May 2002 17:33:08 Andrew Watson replied:
As long as youve got the date the its easy...

this little snippet will give you the dayname of any date...(ive just used the current server date)

<pre id=code><font face=courier size=2 id=code>
&lt;%
myDate = Date
myDay = WeekdayName(Weekday(myDate))
%&gt;
</font id=code></pre id=code>

so as long as you know the date then just use the DateAdd function to move back or forward a day and then return the day names for those dates.


Also you can use.

<pre id=code><font face=courier size=2 id=code>
&lt;% FormatDateTime(Date, 1) %&gt;
</font id=code></pre id=code>

This returns the date in long format.

TO move to the day after a date use this...

<pre id=code><font face=courier size=2 id=code>
&lt;%
tomorrow = DateAdd("d",1,Date)
%&gt;
</font id=code></pre id=code>

and yesterday...

<pre id=code><font face=courier size=2 id=code>
&lt;%
tomorrow = DateAdd("d",-1,Date)
%&gt;
</font id=code></pre id=code>

You should get what you want with these functions.....

Cheers
Leed

:: Son, im Thirty.... ::
Replied 02 May 2002 17:41:22
02 May 2002 17:41:22 David Behan replied:
Thanks mate, will put them into my copy book for re-reference!

Cheers

_________________________
David Behan - www.bmor.com

Reply to this topic