How do you get the current date time in mercury? Now() and Date$ do not work.
@mh: Now() should have worked - can you add this as missing keyword?
What platform? .NET’s System.DateTime as “Now”, but Elements RTL’s DateTime class has only
is Now() a global function provided by Visual Basic? If so, we can add it to MBL, of course.
Sure? Where is this defined? Google only finds me DateTime.Now(), and a Now() function in VBA/VB6…
It is coming from the VisualBasic.dll.
Module DateAndTime, function Now
Ah yes. thats in MBL already, just disabled (because it didn’t compile, at some stage). lemme see if I can enable it.
Now() is part of the Microsoft.VisualBasic namespace. In VS Mac I have to add a reference to it and then import that namespace first before I can actually use it.
IIRC it’s logged for next week for “RemObjects.Elements.Mercury” and (by extension, where available, Microsoft.ViksualBasic" to automatically be in the Imports scope, for .vb files. That means on .NET you’ll then have these APIs automatically — until them the workaround would be to add the namespace as Imports or to the “Default Uses” setting (see “Project|Manage Namespaces” in Fire/Water, or manually set the setting, in VS).
A distinction needs to be made between whats .NET APIs and what’s the VB/Mercury language. DateTime.Now and Now() are .NET APIs, and .NET APIs all not be available on the platforms, per se.
Some, very common VB-specific APIs we will provide, where feasible and scope allowing, on all platforms, via the Mercury Base Library.
Now() might become one of those APIs.
Elements RTL is the best set of shared APIs to use, for platform-agnostic code; it works with Mercury but is designed for all Elements languages (and platforms).
As of build 10.0.0.2605 this still does not work. Now or Now() gives an error…“Did you mean low”" Well no compiler I meant now.
Do you have Microsoft.VisualBasic in the Imports?
Imports Microsoft.VisualBasic Module Program Sub Main(args as String()) writeLn("The magic happens here.") writeLn(Now()) End Sub End Module
builds fine for me.
Interesting that if I copy the contents of the file over to water it does not compile, but if I import it it compiles. Lesson learned.
can I see a test case project where this does not compile? I assume you Ade sure you had the
Imports Microsoft.VisualBasic line?