The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,119 other followers

Archive for the ‘ISO 8601’ Category

ISO-8601: What’s the Current Week Number?

Posted by jpluimers on 2012/08/16

Quick way to get the current ISO-8601 based week number: What’s the Current Week Number?.

–jeroen

Posted in Internet, ISO 8601, Power User | 5 Comments »

ISO 8601 Date, Time and DateTime in Delphi (was: Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool)

Posted by jpluimers on 2011/08/18

In the past I wrote about a Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool , using ISO 8601 in batch-files, and how ISO 8601 is used in Google Calendar URLs.

Time to write something about ISO 8601 Date, Time and DateTime and Delphi.

First of all the DateUtils unit contains a bunch of routines (for instance DecodeDateWeek) that understand ISO 8601 week numbers, where:

  • Weeks start at Monday
  • The first week of a year contains (these are equivalent):
    • The first thursday in that year
    • Has at least 4 days in that year
    • Contains the 4th of January

Otherwise the week containing January 1st is week 52 or 53 of the previous year

ISO 8601 also specifies how to format Dates, Times,  DateTimes and durations according to some basic principles.

XML uses ISO 8601 to format Date, Time and DateTime and some other formats as text too.

So it is no wonder that since Delphi 6, it contains a XSBuiltIns unit covering (among other things) ISO 8601 formatting.

Given the many Delphi ISO 8601 relates questions on StackOverflow of which I answered two, and my need for ISO 8601 DateTime conversion for exporting Excel XML, here is are some samples to get started in the unit below (and in this codeplex changeset).

The unit covers Date, Time and DateTime.
You can write similar code for Duration.

Oops, I covered it already in ISO 8601: Delphi way to convert XML date and time to TDateTime and back (via: Stack Overflow)

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, ISO 8601, Power User, Software Development | 4 Comments »

Simple example to show DateTime.Now in ISO 8601 format on ideone.com | Online C# Compiler & Debugging Tool

Posted by jpluimers on 2011/05/17

I’m a fan of ISO 8601, as it is a universal way of expressing dates and times (no more MDY confusion ).

I wrote about using ISO 8601 in batch-files and with Google Calendar before.

Now it is time to give you a simple C# example.

When you realize that XML uses ISO 8601 for their date and time formats, the .NET conversion is very easy:

using System;
using System.Xml;

public class Test
{
    public static void Main()
    {
        string Iso8601DateTime =
            XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Local);
        Console.WriteLine(Iso8601DateTime);
    }
}

I wrote about ideone.com before: it is an excellent place to run sample C# code (and other languages).

When running this on ideone.com, you can see their local server time in ISO 8601 format.
Cute :-)

BTW: There are more ways to run your C# code online.

–jeroen

via: Simple example to show DateTime.Now in ISO 8601 format on Ideone.com | Online C# Compiler & Debugging Tool.

Posted in .NET, C#, Development, ISO 8601, Power User, Software Development | 1 Comment »

batch file scripts to get current date and current time in sortable ISO 8601 format

Posted by jpluimers on 2011/01/10

ISO 8601 is a great format for date and time (and combined) values.
It allows for both interchange of information, and ease of sorting values.

Recently, I had to create some backup and logging scripts for a 3rd party turn-key installation at a client.
You know: the kind of installation where the 3rd party manages to break their own scripts, but at the mean time close the system so much, that you cannot do anything but standard batch-file scripts.

The system runs partially on a Workstation that is based on a Dutch version of Windows XP, and a server that runs an English version of Windows Server 2008.
Recipe for some twiddling in order to keep the scripts working on both systems, and not to get bitten by localization.

This answer to a StackOverflow question got me a nice head-start: it was said to work in both the English and Portugese versions of Windows.
This post is the process to get correctly function batch-files towards the end of the post.

Of course, we Dutch are persistent enough to have yet different output for the %date% pseudo variable and the date and date /t commands.
The same holds for the %time% pseudo variable and the time and time /t commands.
Read the rest of this entry »

Posted in Batch-Files, Development, ISO 8601, Power User, Scripting, Software Development, Windows, Windows 7, Windows Vista, Windows XP | 4 Comments »

Google Calendar – printing multiple months or weeks to PDF – URL parameter tips and tricks

Posted by jpluimers on 2010/06/28

Recently, I had to print multiple months or weeks from within Google Calendar.
The default UI does not allow that, but it is in fact pretty easy to do.

These are the steps to get PDF versions of a whole year.

Edit 20100714: thanks to Kilian Croese, I could explain a few more parameters, and cut out the steps for Fiddler, so it now works with most browsers on most platforms.
All text that is not relevant any more is marked deleted, so you can still read it if you want to use Fiddler.
It works from Google Chrome and Internet Explorer on Windows (FireFox works if you install FiddlerHook) Read the rest of this entry »

Posted in Development, Fiddler, Google, Google Apps, ISO 8601, Power User, Software Development, Web Development | 19 Comments »

 
%d bloggers like this: