473,508 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsl date format

xsl newbie question: I don't seem to be able to find a simple function
to convert a date in DD/MM/YY format to an integer since Epoch. I have
the DD/MM/YY value in one mySQL database and trying to dump the data
into another database - the app that's using the second database
requires the date to be an integer.

Surely this is a fairly common requirement to transform dates to and
from the integer value?

Jul 21 '06 #1
2 6558
ma**************@cscworld.com wrote:
Surely this is a fairly common requirement to transform dates to and
from the integer value?
Common application requirement, but not a common stylesheet requirement,
so it isn't part of XSLT 1.0. (I'm not sure whether 2.0, which does more
with datatypes, adds it.)

Personally, I'd say it's time to investigate your XSLT processor's
support for extension functions. If you're using Xalan-J, for example,
it's not hard to invoke the Java date support. Downside is that
extension functions are nonportable (or, in the case of the EXSLT
semi-standard, only semi-portable) since they aren't part of the XSLT
standard.
Jul 21 '06 #2


ma**************@cscworld.com wrote:
xsl newbie question: I don't seem to be able to find a simple function
to convert a date in DD/MM/YY format to an integer since Epoch. I have
the DD/MM/YY value in one mySQL database and trying to dump the data
into another database - the app that's using the second database
requires the date to be an integer.
XSLT/XPath 1.0 does not have any date data type.

XSLT/XPath 2.0 uses the XSD schema types which have a format like
YYYY-MM-DD (plus the possibility for time zone information). There is a
substraction operator '-' defined on the date data type so you can do e.g.
xsd:date('2006-05-09') - xsd:date('1970-01-01')
which gives you a value of type duration from which you can extract the
number of days, hours, minutes, seconds with functions like
days-from-duration(xsd:date('2006-05-09') - xsd:date('1970-01-01'))
That way you can implement a function that converts the duration into
seconds.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 21 '06 #3

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

Similar topics

15
42977
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
2
5049
by: amith | last post by:
hi I have written javascript for comparing two dates in US format and finding out whether the start date is greater than the end date and vice versa. In this attempt i have instantiated the...
4
5344
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
3
11569
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
5
816
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
12
29422
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
20
35385
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
30
5646
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
4
3039
by: OzNet | last post by:
I have some functions to calculate the working days in a given period. This includes a table that is queried to calculate the number of public holidays that don’t occur on a weekend. If I test...
11
6159
ollyb303
by: ollyb303 | last post by:
Hello, I am using a dynamic crosstab report to track performance statistics for my company and I have hit a problem. I would like the option to track stats daily (for the last 7 complete...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.