A little bit of everything…
RSS icon Home icon
  • Calculating age with JavaScript

    JavaScript LogoI’ve been working on a simple form – nothing really challenging – where members of a group can provide some data about themselves for registration purposes. However I tried adding an extra function to it: a small text field next to where they input their birth data, which displays their age (according of course to the birth date they provided).

    I thought therefore I could share this small piece of code so that other people wishing to add it to their websites can use it. The internet is already full of such scripts, but who knows, maybe someone finds it here and finds it useful…

    Read the rest of this entry »

  • PHP: converting string into formatted date

    While coding I came across the following situation: a date which was showed with the format YYYY-MM-DD, but I wanted its format to be DD-MM-YYYY.

    Obviously there’s the PHP Date function, you will think, but the point here is that the initial date was a variable as string. Therefore using directly the date function did not work…luckily it is not difficult to find out how to get the desired results.

    Read the rest of this entry »