standardtime.inc

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

3x
orc pawn
orc pawn
Posts: 20
Joined: Sun Jan 25, 2004 12:54 am

standardtime.inc

Post by 3x » Fri Feb 27, 2004 1:28 am

Code: Select all

|standardtime.inc
|This include will echo a user friendly standardized time instead of military time.
|usage: /call standardtime



Sub standardtime


/declare hours global
/declare newhours global
/varset newhours 0
/varset hours $time(h)




/if n @hours>12 { 
			/varset newhours $calc(@hours-12)
			/varset newhours $int(@newhours)

			/echo @newhours:$time(m):$time(s) PM
		   } ELSE {
			/echo $time(h):$time(m):$time(s) AM
			  }

/return

Grumpy
a hill giant
a hill giant
Posts: 167
Joined: Sun Nov 10, 2002 4:22 pm

Post by Grumpy » Fri Feb 27, 2004 11:28 am

Code: Select all

|standardtime.inc
|This include will echo a user friendly standardized time instead of military time.
|usage: /call standardtime



Sub standardtime

	/varset hours $time(h)
	/varset daynight "AM"
	/if n @hours == 0 {
		/varset hours 12
	} else if n @hours > 12 {
		/varset hours $calc(@hours-12)
		/varset daynight "PM"
	}
	/echo @hours:$time(m):$time(s) @daynight

/return

Guest

Post by Guest » Fri Feb 27, 2004 6:23 pm

Grumpy, did you even try your macro? Its full of errors.