0

In one of application which I use, I have a database on MS SQL Server 2012. In this database date of type integer (which is normal in database based on MS SQL Server 2012).

Now I try to write xslt which transform xml from this system on account system and I have problem to convert this integer value. For example: in the database i have value 79192 which is the same like date 23-10-2017. I know that in this conversion I should use value 36163 and subtract it form value 79192.

I know how to do this In MS SQL like this CONVERT(VARCHAR(10), cast(79192 - 36163 as datetime), 120).

Please tell me how to do this convert in xslt 1.0? Can I do this with some function or I have to write template which convert this value?

Harry
  • 1,233
  • 10
  • 24
jeffers
  • 145
  • 3
  • 13
  • something like this? https://stackoverflow.com/questions/19271594/converting-epoch-to-date-time-with-time-zone-in-xslt-2-0 – Harry Nov 08 '17 at 19:40
  • Why don't you create a view, do conversion inside the view and then user the view in your XSLT process? – FLICKER Nov 08 '17 at 19:43
  • What do you mean by *which is normal in database based on MS SQL Server 2012*? In SQL-Server it is far off normal to store a date as integer. Where are these values coming from? 2017-10-23 minus 79192 days is Sunday, 28 December 1800. This might be [coming from a clarion database](http://www.excelkey.com/forum/viewtopic.php?f=3&t=353)? – Shnugo Nov 09 '17 at 13:25
  • Assuming that this is kind of clarion date you might add your values to `1800-12-28` rather than subtracting any magic values to fit to SQL Server's *zero day*. [You might read this answer](https://stackoverflow.com/a/23569278/5089204) providing some pure XSLT 1.0 day adding. For convenience there are extensions or a higher version. – Shnugo Nov 09 '17 at 15:19
  • Hi there. Today I get solve of my problem. I found solve in this post on stackoverflow https://stackoverflow.com/questions/23566734/date-operations-on-xsl-1-0/23569278#23569278. I implement template into my source code and it works perfect. So If someone have the same problem you can use that. Thanks a lot for help form other users. – jeffers Nov 16 '17 at 06:25

0 Answers0