472,805 Members | 906 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

Work out Yesterdays date

Hi,

Does anyone know where i can get some javscript code to work out yesterdays
date

Thanks
Mark
Jul 23 '05 #1
6 4969
Mark wrote on 20 feb 2005 in comp.lang.javascript:
Does anyone know where i can get some javscript code to work out
yesterdays date


<script type='text/javascript'>
var D = new Date()
with (D) setDate(getDate()-1)
alert(D)
</script>

From:
<http://www.merlyn.demon.co.uk/js-date1.htm#incr>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #2
Mark wrote:
Hi,

Does anyone know where i can get some javscript code to work out yesterdays
date


d=new Date().getDate()
d.setDate(d-1)

Mick
Jul 23 '05 #3
Mick White wrote:
Mark wrote:
Hi,

Does anyone know where i can get some javscript code to work out
yesterdays date


d=new Date().getDate()
d.setDate(d-1)

Mick

sorry
d=new Date()
dt=d.getDate();
d.setDate(dt-1)

Mick
Jul 23 '05 #4
Mick White wrote:
Mick White wrote:
Mark wrote:
Hi,

Does anyone know where i can get some javscript code to work out
yesterdays date
[...]
sorry
d=new Date()
dt=d.getDate();
d.setDate(dt-1)

Mick


Supposing, of course, that d is actually a date object that
represents 'today' as opposed to whatever date the users' PC has
been configured to think it is.

--
Zif
Jul 23 '05 #5
Zifud wrote:
yesterdays date

d=new Date()
dt=d.getDate();
d.setDate(dt-1)

Mick

Supposing, of course, that d is actually a date object that
represents 'today' as opposed to whatever date the users' PC has
been configured to think it is.


True, Zif, I should have issued the usual caveats.
Mick
Jul 23 '05 #6
Mick White wrote:

True, Zif, I should have issued the usual caveats.
Mick


Just thought I'd steal JRS's thunder. ;-)

--
Zif
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: OldGuy | last post by:
Hi All Sendmail 8.12.11 php 4.3.9 Sendmail is installed and works properly. php is NOT in safemode from the command line; mail user@domain.com < testmsg works fine.
1
by: VB Programmer | last post by:
How can I get yesterdays date? I would think now.date.subtract(1) works, but it doesn't. Thank.
8
by: Anonmyous | last post by:
Hello, how can I get the yesterdays date? Thanks for any suggestions and tips.
4
by: Bruno | last post by:
How do I check if a date variable is empty? I mean, if I declare a variable like this dim d as Date how do I know if any date was assigned to d? example, d = now
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
5
by: Screaming Eagles 101 | last post by:
Hi, I'm looking for some code to find the right work shift according to a specific date and time. This one worked fine in VB6, but somewhere I do not succeed in converting it to VB2005 code.......
4
by: dougmeece | last post by:
Morning Everyone... I have a table that needs to be append to and also updated. All the fields in the table are populated with data from the text boxes and combo boxes on a form. The Date...
5
code green
by: code green | last post by:
I need to do a query something like SELECT * FROM invoices WHERE date= 'yesterdays date'It is not as simple as one might think which means ideas I have looked at vary widly. Could someone please...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.