Posts tagged with 'date'


Calculating the date of Easter for a particular year

A long time ago, in a galaxy far, far away – OK, it was in London in 1993 – I added a DateEaster function to my personal Dates unit, written in Borland Pascal 7. So: 16-bit DOS for all you oldies. For a bit of fun, I shall present it here with some commentary. At the time I was really proud of this unit: the majority of it was written in assembly for speed reasons (it was used in a swaps trading app I was writing) and it could calculate things like days between two dates (including on a 360-day basis...

READ MORE

JavaScript for C# developers: writing a library (part 2)

As I said last time, my first library object is going to be a cookie object. photo © 2007 Myscha Theriault | more info (via: Wylio ) The browser API for this is remarkably simple . There’s a string property of the document object called cookie . Read from it and you get a semicolon-separated list of name=value pairs as a string. Each name is the name of a cookie and the value is its value. Write to it with a specially formatted string (again semicolon-separated) and you add or update a single cookie...

READ MORE

JavaScript for C# developers: date basics

A scenic diversion on the road to understanding JavaScript when you're a C# programmer. In this episode, we'll look at dates in JavaScript. Dates are implemented in JavaScript by the Date() constructor function, which acts like a class. You can new up a Date object in much the same way as you new up a DateTime object in C#. For instance, here's how to create a date that's equal to the date I wrote this post (Mon, Apr 27, 2009): var today = new Date( 2009 , 3 , 27 ); console.log(today.toDateString...

READ MORE