Page 1 of 1 1
Topic Options
#120467 - 2004-06-02 12:03 AM @DATE in Standard US Format?
chmod Offline
Fresh Scripter

Registered: 2004-06-01
Posts: 24
Loc: Sacramento, CA
Is there a way to change the @DATE to reflect the date in a standard US format besides this;
$us_date = "@MONTHNO" + "/" + "@MDAYNO" + "/" + "@YEAR"

Also, how does one display the Year number (i.e. 04 ) instead of 2004?

Top
#120468 - 2004-06-02 12:05 AM Re: @DATE in Standard US Format?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
You can use the SPLIT and JOIN commands to manipulate those data strings anyway you want.

Please search the board for sample code or search the UDF Forum or mirrors. http://www.kixhelp.com/udfs

Top
#120469 - 2004-06-02 12:11 AM Re: @DATE in Standard US Format?
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Code:

$date = split(@date ,"/")
$date = "" + val($date[1]) + "/" + val($date[2]) + "/" + substr($date[0],3)
? $date



will give 6/1/04


Top
#120470 - 2004-06-02 12:14 AM Re: @DATE in Standard US Format?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...in other words, NO.
@Date format cannot be configured to any other than what it is. As you discovered though, you can concatenate several other macros. To trim @Year to two digits, use the Right() function.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#120471 - 2004-06-02 07:03 PM Re: @DATE in Standard US Format?
chmod Offline
Fresh Scripter

Registered: 2004-06-01
Posts: 24
Loc: Sacramento, CA
I am posting my end result as it might help some else. I wanted the date time in a format as to append to a file name on a scripted backup.

Code:
Global $filedatetime, $date, $time, $ampm
usdatetime()
$filedatetime = $date + " " + $time + $ampm
? $filedatetime


Function usdatetime()
$hour = SubStr("@time",1,2)
Select
Case Val("$hour") < 12
$ampm = "am"
Case Val("$hour") > 18
$ampm = "pm"
Case 1
$ampm = "pm"
EndSelect
$date = Split(@date ,"/")
$time = Split(@time ,":")
$date = "" + Val($date[1]) + "-" + Val($date[2]) + "-" + SubStr($date[0],3)
$time = "" + Val($time[0]) + Val($time[1]) + SubStr($time[0],3)
EndFunction


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.158 seconds in which 0.093 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org