Solved

Changing the default hour and day function format

Posted on 2006-11-21
2
144 Views
Last Modified: 2010-04-30
Hi,

I never use VB but I am looking at a DTS script that looks for the hour and day and second to have the leading 0.

so 9am on 1/1/2006 should be 0900 01012006

Here are the current functions:

the hh, mon, da and min needs to be updated.

mydate =now()
hh=Hour(time)
min=Minute(time)
yy=Year(date)
mon=Month(date)
da=DatePart("d",Date)

Thanks
0
Comment
Question by:sjsharp80
2 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
Comment Utility
mydate = Now()
hh = LZ(Hour(Time))
Min = LZ(Minute(Time))
yy = Year(Date)
mon = LZ(Month(Date))
da = LZ(DatePart("d", Date))
Stop


Here's the function:
Function LZ(str)
  LZ = str
  If (str >= 0) And (str < 10) Then LZ = "0" & str
End Function
0
 

Author Comment

by:sjsharp80
Comment Utility
Perfect, thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now