rickd Posted June 26, 2007 Share Posted June 26, 2007 Hi, Is it possible to get the current date/time into the format "9.20pm Thu 21" using the build-in date/time functions? Link to comment Share on other sites More sharing options...
herewasplato Posted June 26, 2007 Share Posted June 26, 2007 Yes. ...and now I suppose that you want to know how :-) Take a look at _DateTimeSplit then parse it via the string functions then concatenate as desired...MSP [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
rickd Posted June 26, 2007 Author Share Posted June 26, 2007 Thanks, I couldn't find anything in help about getting the day though, is that possible? Link to comment Share on other sites More sharing options...
/dev/null Posted June 26, 2007 Share Posted June 26, 2007 Thanks, I couldn't find anything in help about getting the day though, is that possible?@MDAY and @WDAY __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
rickd Posted June 27, 2007 Author Share Posted June 27, 2007 @MDAY and @WDAY Thanks, I had a go at getting the date/time into the format I want, this is the code.. is this the best way to do it? Or someone has a more efficient solution? #Include <Date.au3> Local $numericday = @WDAY Local $numericdate = @MDAY Local $time = _NowTime(3) Local $ampm Local $datesting If $numericday = 1 Then $textday = "Sun" ElseIf $numericday = 2 Then $textday = "Mon" ElseIf $numericday = 3 Then $textday = "Tue" ElseIf $numericday = 4 Then $textday = "Wed" ElseIf $numericday = 5 Then $textday = "Thur" ElseIf $numericday = 6 Then $textday = "Fri" ElseIf $numericday = 7 Then $textday = "Sat" EndIf If StringInStr($time, "a.m.", 0, 1) <> 0 Then $ampm = "am" ElseIf StringInStr($time, "p.m.", 0, 1) <> 0 Then $ampm = "pm" EndIf $time = StringTrimRight($time, 8) $datestring = $time & $ampm & " " & $textday & " " & $numericdate ;Display the resulting time/date string msgbox(1,"",$datestring) Link to comment Share on other sites More sharing options...
the_lord_mephy Posted June 27, 2007 Share Posted June 27, 2007 Can't you just do if @hour > 11 then $ampm = "PM" else $ampm = "AM" endif msgbox(1, "", _NowTime(3) & $ampm & " " & StringLeft(_DateDayOfWeek, 3) & " " & @MDAY) of course then Thursday is going to be displayed as Thu instead of Thur My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now