473,387 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question: Time comparisons

I want my web page to take the current time and either say "Good
Morning/Afternoon or Evening". Any ideas how I can do this? I tried this
but it's taking the times as strings...

Dim strMyTime As String = Now.ToShortTimeString

If strMyTime < "11:30 AM" Then
Response.Write("Good Morning")
ElseIf strMyTime > "11:30 AM" And strMyTime < "4:30 PM" Then
Response.Write("Good Afternoon")
Else
Response.Write("Good Evening")
End If
Thanks!
Nov 18 '05 #1
1 964
"VB Programmer" <Do*****************@jEmail.com> wrote in
news:#L*************@TK2MSFTNGP11.phx.gbl:
I want my web page to take the current time and either say "Good
Morning/Afternoon or Evening". Any ideas how I can do this? I tried
this but it's taking the times as strings...

Use the functions: Hour, Minute.

So something like

If Hour(Now()) < 11 and Minute(Now()) <= 30 then
lblTextBox.Text = "Good Morning"
End If

There's probably a more elegant want, but I'm brain dead.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: 2mc | last post by:
Generally speaking, if one had a list (from regular Python) and an array (from Numerical Python) that contained the same number of elements, would a While loop or a For loop process them at the...
33
by: Mohanasundaram | last post by:
Hi All, As per the standard what is the result of passing NULL to both malloc and free? Regards, Mohan. http://www.gotw.ca/resources/clcm.htm for info about ]
22
by: James H. | last post by:
Greetings! I'm new to Python and am struggling a little with "and" and "or" logic in Python. Since Python always ends up returning a value and this is a little different from C, the language I...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
27
by: karan.shashi | last post by:
Hey all, I was asked this question in an interview recently: Suppose you have the method signature bool MyPairSum(int array, int sum) the array has all unique values (no repeats), your...
3
by: cj | last post by:
If I want to check to see if it's after "11:36 pm" what would I write? I'm sure it's easy but I'm getting tired of having to work with dates and times. Sometimes I just want time or date. And...
10
by: rasta475 | last post by:
I am working with a Compact Framework project that was written in VB.Net using Visual Studio .Net 2003. That said I have been given the task of making it run "faster". I am a C# programmer and I...
10
by: Jeff | last post by:
I guess that I should have explained better (I'm stil new with this, so I may not be asking the questions in the best way) Normally, one would use the simple code: if x>y then something end...
5
by: Chad | last post by:
I was looking at some old posts in comp.lang.c and found the following ...
37
by: Richard Heathfield | last post by:
candide said: They aren't. An array is an array. An address is a pointer value. These are not the same thing. If you mean that &array and &array are the same, they aren't. They have different...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.