Help - Search - Members - Calendar
Full Version: time and date
The CD Forum > CD Shell and Boot Scriptor > Troubleshooting & Problems
spock2005
I cant get the time and date to display right in cd shell ( cds2106 )
QUOTE
boot:
cls
print "\n"
print "Press Enter to boot from DVD... \n"
getkey 5 boot 0x80
if $lastKey == key[enter]; then goto time
# When no key found...
goto boot

# Function to display time of day
time:
set hour = $timeHour
set ampm = "am"
if $timeHour > 12; then set hour = $timeHour - 12
if $timeHour > 12; then set ampm = "pm"
set time = "$hour:$timeMinute$ampm"

# Function to display date
date:
set month = "n/a"
if $dateMonth == 1; then set month = "Jan."
if $dateMonth == 2; then set month = "Feb."
if $dateMonth == 3; then set month = "Mar."
if $dateMonth == 4; then set month = "Apr."
if $dateMonth == 5; then set month = "May."
if $dateMonth == 6; then set month = "Jun."
if $dateMonth == 7; then set month = "Jul."
if $dateMonth == 8; then set month = "Aug."
if $dateMonth == 9; then set month = "Sep."
if $dateMonth == 10; then set month = "Oct."
if $dateMonth == 11; then set month = "Nov."
if $dateMonth == 12; then set month = "Dec."
set date = "$month$dateDay,$dateYear"

# Printing the Interface
menu:
set textColor= color[white on black]
set boldColor= color[cyan on black]
cls
print c "\n\cXXÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ<\c0B$time $date\cXX>ÄÄ \n\n"
print c "\cXXUnattended Multi-Boot DVD\n\n"
print c "\cXXWindows XP Professional SP2 Corporate \n"
print l "\cXXPress \c0BF1 \cXXfor Help"; print r "\c0Bs....@h.....l.com \n"
print c "\cXXÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ÄÄÄÄÄÄ \n\n"

it looks like this when displayed

<1:$timeMinutepm $month2
0,2006>

What is wrong
ok i got it by puting a space in these lines
set time = "$hour:$timeMinute $ampm"

set date = "$month $dateDay, $dateYear"

can any one tell me how to get the space out between the minute and ampm , so it displays with out a space there
jmblack
I coded mine a bit differently. Basically if you apply the AM PM as a seperate variable you can get the behavior you want.

CODE
heading:
#
#              Standard Heading for all sections - shows help and Bootable CD Title
#
clear
set hour = $timeHour
set ampm = "AM"
if $hour > 12        # Check for PM time.
    then set hour = $hour - 12
    then set ampm = "PM"
if $hour == 0        # Check for 12 AM (midnight).
    then set hour = 12


Print l "\c07  ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
Print r "$dateMonth-$dateDay-$dateYear  "  
Print l "\c07  ³F1 - Help      ³"
print r "$hour:$timeMinute$ampm  "
Print l "\c07  ³F2 - Main      ³             Bootable CD                  \n"
Print l "\c07  ³F3 - Other     ³                                          \n"
Print l "\c07  ³F4 - Network   ³"
print r "$procName "
Print l "\c07  ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ                                          \n"
if $dateYear < 2006        # If the bios isnt set to at least 2006 the time MUST be wrong
    then Print c "Back to the future... fix the bios date" \n"
return
rewss
Thanks. i did ur way and made date comes out properly.
But, i think u gotta rework on ur time code.
Cause when i used it, still the time doesn't come out properly.
And i'm now trying to making it come out properly.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.