Normal Topic Time Display (Read 751 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Time Display
Jan 14th, 2006 at 11:38pm
Print Post Print Post  
Hi -

How can I have the time displayed (through programming) as a.m. or p.m.?

In other words, if I use "LETime = @time" in programming, it returns, e.g. 15:59 and I want it to return 3:59 p.m.

I couldn't find it in the Proramming Guide.

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Time Display
Reply #1 - Jan 15th, 2006 at 12:11am
Print Post Print Post  
The LE should display via its format without regard to programming. In Sesame 1.x you cannot change the LE display format dynamically. If you need to display in one format some of the time and a different format at other times, in the same LE - make two, one with each format, neither bound, and hide and reveal as needed.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Time Display
Reply #2 - Jan 15th, 2006 at 12:19am
Print Post Print Post  
Mark -

Hmm.  Guess I didn't give a good clear example.  That's what happens when you get lazy and try to make your request "short."

I'm not trying to display the time in a "time" formatted LE (I would think I could do that when establishing the LE).

I am actually trying to use it in a text box to say

Message sent Saturday, January 14, 2006 at 7:05 p.m.

I can manipulate the date using @DOM$(@date) etc etc ... I was looking for something similar with @time.

Thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Time Display
Reply #3 - Jan 15th, 2006 at 12:43am
Print Post Print Post  
In GLOBAL CODE:
Code
Select All
function TwelveHour() as string

var aa as string
var bb as int
var cc as string

aa = @str(@time)
bb = @ToNumber(@left(aa, 2))
if(bb > 12)
{
	aa = @str(bb - 12) + ":" + @right(aa, 2) + " pm"
}
else
{
	aa = aa + " am"
}
return aa
end function
 



Anywhere else:
Code
Select All
var ww as string
ww = TwelveHour()
writeln(ww)
 

  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Time Display
Reply #4 - Jan 15th, 2006 at 1:25am
Print Post Print Post  
Mark -

That worked like a charm.  Thanks!

I'm just curious.  Would it not be possible to have a command that could do that for us?  It would be so much easier for example if I could simply use in my message code something like @time(12hr)?

The code you provided me is certainly simple enough and does what I need - BUT - I wouldn't have had a clue how to about this without your help.

I'm looking for as many commands as possible that would allow me (and other "casual" programmers) to be able to find simple solutions within our own "means."

Again, much thanks!
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Time Display
Reply #5 - Jan 15th, 2006 at 1:39am
Print Post Print Post  
Sesame 2.0 has a formatting command: @AsFormattedByLE.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Re: Time Display
Reply #6 - Jan 15th, 2006 at 1:51am
Print Post Print Post  
FANTASTIC!!!!!


So, has anyone asked lately when we might get our grubby, greedy paws on 2.0?

lol
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged