Hi,
I'm sure this has been done before, but I can't seem to find this one on the net....
I have a datefield but instead of it just displaying:
07/12/18 08:30
I would like to display it as: 07/12/18 MORNING
or when it's 07/12/18 12:00 as: 07/12/18 NOON
and 07/12/18 14:30 as: 07/12/18 AFTERNOON
From 00:00 till 11:30 = MORNING
from 11:30 till 13:30 = NOON
from 13:30 till 17:00 = AFTERNOON
Can someone plz help me with this?
Thanks alot in advance!
Joachim
9 2217 QVeen72 1,445
Recognized Expert Top Contributor
Hi,
Extract the TimePart from the Date, Use a "Select Case" or "IF" condtion to print the Day Part..
REgards
Veena
You simply need to extract the time part only anc compare as per youir range and display accordingly.
Hi,
Extract the TimePart from the Date, Use a "Select Case" or "IF" condtion to print the Day Part..
REgards
Veena
This is what I have: -
Function Value
-
-
If Not IsNull(DeadLine) Then
-
If TimeValue(DeadLine) = 0 Then
-
Value = Format(DeadLine, "dd/mm/yyyy")
-
Else
-
If DateValue(DeadLine) = 0 Then
-
Value = Format(DeadLine, "hh:mm")
-
Else
-
Value = Format(DeadLine, "dd/mm/yyyy, hh:mm")
-
End If
-
Value = Value & " uur"
-
End If
-
Value = Value
-
End If
-
-
If Not IsNull(Me.EstimatedTime) Then
-
If Value > "" Then
-
Value = Value & ", "
-
End If
-
Value = Value & "duur ca." & Format(Me.EstimatedTime, "0.0#") & " uur."
-
End If
-
-
End Function
So I want to take the hour from this: -
-
Function TimeOfDay()
-
If TimeValue(Me.EstimatedTime()) < 11 Then
-
TimeOfDay = "Voormiddag"
-
End if
-
-
If TimeValue(Me.EstimatedTime()) =>11 AND TimeValue(Me.EstimatedTime()) < 13 Then
-
TimeOfDay = "Middag"
-
End if
-
-
If TimeValue(Me.EstimatedTime()) => 13 Then
-
TimeOfDay = "Namiddag"
-
End if
-
End Function
But it doesn't work ....
Can you help me plz?
Thanks.
you need to capture only the hour from time part in 24 hrs format and compare the same in a simple select case and display as desired.
you need to capture only the hour from time part in 24 hrs format and compare the same in a simple select case and display as desired.
Sorry, but i'm a real newbie.
Can you help me with the code please?
Thanks ....
QVeen72 1,445
Recognized Expert Top Contributor
Hi,
Dont Use, TimeValue ...
Use Hour(MyDate) in your TimeOfDay function..
REgards
Veena
Do not post duplicate threads or send PM to anyone it is strictly against forum rules. Do as sugested by our expert in the previous post.
Hi,
Dont Use, TimeValue ...
Use Hour(MyDate) in your TimeOfDay function..
REgards
Veena
Thank you so much! It works!! :)
Do not ... send PM to anyone it is strictly against forum rules
This is a valid point, but comes across in this post as a slight exaggeration. I'd just like to clarify.
It is not "strictly against forum rules" to send anyone a PM. Private Messages are often used to chat "off list" to avoid cluttering up the discussion forum. But for technical questions and answers we want everything in the forum so it's available for later reference. TheScripts is all about the free exchange of information, so discussing these things in private goes against that ideal.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrew |
last post by:
Hi,
I select from an Access table " where date >= '3/1/2004' and date
<='3/31/2004' ", but no record. Can you tell me how to make this
comparission?
Thanks
--
Andrew
|
by: goochey |
last post by:
I'm trying to convert a Julian Date (Format "4365") into an actual calendar
date in Visual Basic, can anyone help me out with this.
|
by: clintonG |
last post by:
When the following code is run on Sat Dec 25 2004 19:54:18 GMT-0600 (Central
Standard Time)
var today = new Date();
var GMTDate = today.toGMTString();
document.write("GMTDate: " + GMTDate);
The code returns:
Sun, 26 Dec 2004 19:54:18 GMT (the next day after the code was actually run)
|
by: Macca |
last post by:
Hi,
I have a table which has a date/time field. I am storing them as follows :-
01/01/2005 11:25
01/01/2005 19:44
02/01/2005 05:04
|
by: DP |
last post by:
hi,
i've got this peice of code;
<script language= "JavaScript">
var today = new Date();
var hourOfDay = today.getHours();
var message = " and welcome to MIS ";
if (hourOfDay >=0 && hourOfDay < 12)
{
| |
by: magix |
last post by:
Hi,
Do you have any javascript available for changing images according to time ?
let say Morning (7am-12pm), using images 1 (e.g morning.jpg)
Afternoon (12 - 6pm), using images 2 (e.g afternoon.jpg)
Night (6pm - 7am), using images 3 (e.g night.jpg)
thanks.
Magix
|
by: mr.nimz |
last post by:
hello,
this is antenio. recently i've come to a problem. i got a way through
it, somehow, still it left me in a curious state, so i'm posting it
here, if i can get an answer from some techy,
here is my table structure,
Name: Table1
|
by: ARC |
last post by:
Hello all,
General question for back-end database that has numerous date fields where
the database will be used in regions that put the month first, and regions
that do not.
Should I save a date format in the table design, such as: mm/dd/yyyy?
What I've done for years is to store the date format in date fields, then on
the forms, based on their region, I would set the date formats on form_load
|
by: indefatigable |
last post by:
This is what I have:
Function Value
If Not IsNull(DeadLine) Then
If TimeValue(DeadLine) = 0 Then
Value = Format(DeadLine, "dd/mm/yyyy")
Else
If DateValue(DeadLine) = 0 Then
Value = Format(DeadLine, "hh:mm")
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |