I need date and time for ios.
The only code I could find gives me errors like DateTime non-existent type.
But this is straight from the manual! And nowhere it says you have to code this differently for ios

Var d As DateTime = DateTime.Now MessageBox(d.ToString(Locale.Current))

Thanks for any help

Try Xojo.core.Date

Everything with “Xojo.*” is for ios

Likewise I would like to use DateTime object in iOS… and I also need to know the timezone offset from GMT - including daylight saving (if applicable).
Seems not possible without DateTime. The Date object doesn’t provide the timezone offset, nor daylight saving.
The timezone can be estimated from longitude - but not reliably - as there are endless departures from that.

Also really annoying are the inverse trig functions.

On one hand sin, cos and tan are supported but to get the inverses is dreadful syntax eg:
Xojo.maths.asin, Xojo.maths.acos, and Xojo.maths.atan2…

This “framework” stuff is an unecessarily verbose longhand that adds nothing meaningful - all it achieves is forcing me to define my own sin, acos and atan methods, as they should have been in the first place.

Xojo.core.timezone and timezone classes work the same way. has a timezone property

Or is it something else you needed?

OK Thanks it works.

But I really wish the folks at Xojo/REAL would drop the “xojo.xyx…” crap, it serves no purpose and I am making my own unified classes and function definitions to eliminate the need for this across both iOS and OSX/Windows desktop apps so that I can actually build apps that re-use the same high-level code CROSS PLATFORM.
Ditto the trig functions which likewise are a mess.

Doubtless I’ll have to deal with the co-called API 2.0 when that comes out, to make that cross platform too.

Anyway here is an example that does compile for iOS:

// Julian date from current date, time and timezone offset from GMT - including daylight saving.
// Uses Jan Meeus’ method, see for example
// It is also the USNO Ephemeris method.

Dim A, B, C, E, F as Integer
Dim jd as Double
Var d As Date = Xojo.Core.Date.Now


// and convert local time to UT (GMT):
jd=jd+d.Hour/24+d.Minute/1440+(d.Second - d.Timezone.SecondsFromGMT)/86400

return jd

//FWIW it would nice if Xojo exposed JD as a property of the Date class, natively. Would make time/date calculations so much easier for those who don’t know the above.

Add “using Xojo.core” to the top of any function and you don’t have to explicitly say it in that function every time.