AnsweredAssumed Answered

how to turn AttemptVO.AttemptDate to actual date

Question asked by wh0046497 on Oct 24, 2016
Latest reply on Oct 25, 2016 by avanderlinde

I am having an issue working out how to turn the Long that websevice AttemptVO.AttemptDate returns into a proper date

According to the internet, The standard way of turning a long into a date in c# is to start at 01/01/1970 and add milliseconds * the long value to get the real date E.g.:

long unixDate = 1297380023295;
DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
DateTime date= start.AddMilliseconds(unixDate).ToLocalTime();

 

However the results I am getting are far too early - I'm getting attempt dates of 15/01/1970 for attempts I know where taken this academic year.

I tried multiplying the long value by days but got an out of bounds error so that is obviously too much.

I tried multiplying the long by seconds and got dates in 2012 - which is the closest yet but still wrong.

Does anyone know how to convert a AttemptVO.AttemptDate into an actual date?

 

Also while I am here:

Trying to use the AttemptFilter =  3 ("get attempt by id's") I can send it the course and an array of Ids and it returns an array of AttemptVO's but it only ever returns 1 AttemptVO - the attempt for the first attempt id in the attempt ids array.

Unless I'm missing something, it looks like it is broken

Outcomes