Date functions
From Buzztard
[edit] Problem description
We will set the date of an song in XML and showing them as info in the ui/command line. We have two dates:
- create date
- change date
The problem is which date format can we use in XML? In glib there are methods for date like g_date_set_parse which get an string and returns a new instance of GDate. But what strings are allowed and what are not?
I have found out, that Posix strings should work. The question now is how we can express in the w3c schema that the date format is valid, if an Posix date string is given? The schema has a type date which can used but I don't know excatly, if this is the right way and the right date-xml type.
waffel 15:29, 15 Apr 2005 (CEST)
[edit] Ideas
In the core lib we start with time(). Now we need to represent that in the string format and vice versa.
from time() to struct tm* (as UTC)
tm = gmtime(time(NULL));
from struct tm * to a char *
strftime(str,len,fmt,tm);
from char * to struct tm *
strptime(str,fmt,tm);
According to the xmlSchema date definition, a representation of the 6th. april 1974 would be valid in the form of '1974-04-06Z'. The 'Z' stands for UTC.
[edit] Ressources
- W3C XML Schema built-in datatypes
- W3C XML Schema date type
- W3C XML Schema type library check section Date and time formats
ensonic 17:12, 15 Apr 2005 (CEST)



