PDA

View Full Version : How to get date ?



nico210
08-16-2009, 11:51 PM
Hello Indigorose forums ! I have a another question for you :
How to get the date in AMS ?

Exemple :

date=System.Getdate()

if date==1 then
Dialog.Message("Today is", "Monday");
end

Thank you in advance !

boku
08-17-2009, 12:23 AM
dow = System.GetDate(DATE_FMT_DAYOFWEEK);

if dow == "2" then
today = "Monday"
end

Dialog.Message("Notice", "Today is " .. today, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);


On my system anyway...

Dermot
08-17-2009, 02:12 AM
or simply


local dow = os.date("Today is %A")
Dialog.Message("Notice", dow)

mystica
08-17-2009, 07:52 AM
Or ...

Assuming you use the European Date Format (Reunion Island is French heritage, yeh?) ... then concatenate Dermot's example with DATE_FMT_EUROPE

eg.


local day = os.date("%A");
date = System.GetDate(DATE_FMT_EUROPE);
Dialog.Message("Date Function", day .. "\r\n" .. date);

mystica
08-17-2009, 08:55 AM
Or, you could even use AMSWave's Script plugin. Download from:
AMSWaves Script Plugin (http://www.amswaves.com/download/AMSWScript.exe)

View his original Post for this plugin at:
http://www.indigorose.com/forums/showthread.php?p=128185

Use this code with the plugin:



code =[[result = Date() + Time()]]
Script.AddCode(code, Script_InternalCode);
date = Script.GetResultAsDate("result");
Dialog.Message("Date & Time", Script.FormatDate(date, "Date: %yyyy.%mm.%dd\r\nTime: %hh:%ii:%ss"))

Dermot
08-17-2009, 09:32 AM
Or ...

Assuming you use the European Date Format (Reunion Island is French heritage, yeh?) ... then concatenate Dermot's example with DATE_FMT_EUROPE

eg.


local day = os.date("%A");
date = System.GetDate(DATE_FMT_EUROPE);
Dialog.Message("Date Function", day .. "\r\n" .. date);


No need for a separate action.

local dow = os.date("Today is %A %d/%m/%Y")
Dialog.Message("Notice", dow)

mystica
08-17-2009, 10:28 AM
cool ... thanx for that, Dermot