Jump to content

12 Hour Time code


Daemonforce

Recommended Posts

I like what flyakite does with the time function in his cd shell script but it's screwing up the first and second lines of my UI 1/4 of the time because of an extra character. I'm getting sick of making fixes each point in the day just to keep it from hurting my eyes. Is there any way to force the function into 24 hour code?

Link to comment
Share on other sites


change your system time to 24hour time; it works for me...

I can't go from that. I've been doing tests in debug mode and vmware and it's the same issue. I found out a bit of code removal fixes it though. Thanks. :)

For those wondering:

# Time Function

time:

set hour = $timeHour

#set ampm = "am"

set time = "$hour:$timeminute"

#if $timeHour > 12; then set hour = $timeHour - 12

#if $timeHour > 12; then set ampm = "pm"

#set time = "$hour:$timeMinute:$ampm"

Now I don't have to worry about it screwing up a quarter of the time. =/

Link to comment
Share on other sites

It came back this morning to haunt me. The problem is I edit the script one part of the day where the time consists of no more than three digits. The objective here is forcing it into the 00:00 time mode regardless of it showing the AM/PM determination.

The time hit 1:00 in the morning....*click*

*time character deleted*

THAT p***ed me off! O_o

I fixed it in a matter of minutes after looking at the script one last time.

# Time Function

time:

set hour = "$timeHour"

set time = "$hour:$timeminute"

Apparently putting quotes around $timeHour fixes this entirely.

Time function debugged successfully. :)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...