Home » U++ Library support » U++ MT-multithreading and servers » Skylark and Date/Time format
Skylark and Date/Time format [message #38973] |
Fri, 01 February 2013 21:20  |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
Hi,
I have a few questions regarding date/time formating in skylark.
When I try to set date scan and print format in main, all settings seem to be ignored.
I have to call SetDateFormat, SetDateScan, SetDateFilter in page handler to force my format.
What is correct way of setting locales in skylark application?
BTW Correct me if I am wrong but the only proper date format for web applications is YYYY-MM-DD and this should be default setting for skylark.
Second problem appears when I receive variable from http, want to modify it and send back to witz script, http keeps old value of variable.
For example:
int i = ScanInt(http["NUM"]);
i++;
http("NUM", i)("NUM2", i).RenderResult(MyApp/script.witz)
NUM keeps old value, NUM2 new value. Is it correct behavior?
Below is complete example:
#include <Skylark/Skylark.h>
using namespace Upp;
SKYLARK(HomePage, "")
{
// SetDateFormat("%1:04d-%2:02d-%3:02d");
// SetDateScan("ymd");
// SetDateFilter("A/\a .-");
Date d = ScanDate((String)http["ID"]);
RLOG(Format("Date befor scan: %s, after scan %`", http["ID"], d));
d = AddMonths(d, 1);
http
("ID", Format("%`", d))
("ID2", Format("%`", d))
.RenderResult("Skylark05/index");
}
struct MyApp : SkylarkApp {
MyApp() {
root = "myapp";
#ifdef _DEBUG
prefork = 0;
use_caching = false;
#endif
}
};
CONSOLE_APP_MAIN
{
SetDateFormat("%1:04d-%2:02d-%3:02d");
SetDateScan("ymd");
SetDateFilter("A/\a .-");
#ifdef _DEBUG
StdLogSetup(LOG_FILE|LOG_COUT);
Ini::skylark_log = true;
#endif
MyApp().Run();
}
index.witz:
<html>
<body>
<form action=$HomePage method="get" accept-charset="utf-8" enctype="multipart/form-data">
<P>
<INPUT type="date" name="ID" value="$ID">
<INPUT type="submit" value="Submit">
</P>
</form>
ID2 = $ID2
</body>
</html>
[Updated on: Fri, 01 February 2013 21:21] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat May 10 06:52:55 CEST 2025
Total time taken to generate the page: 0.03355 seconds
|