Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / September 2004



Tip: Looking for answers? Try searching our database.

Correction for Server Time FormatDateTime()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Colin McNaught - 29 Sep 2004 16:22 GMT
Hi,
(Total VB newbie, plan to stay that way :-)
I would like to correct submitted time on a form-to-email web
application from Server Time to 'Customer Time' (i.e. subtract 3
hours). Is there a simple way to modify the VB function call:
FormatDateTime(Now, 0)
For example is Now actually a value, e.g. in seconds where I could do:
FormatDateTime(Now - 60 * 60 * 3, 0)
I bet that would be too easy...
Colin
Stoil Marinov - 29 Sep 2004 16:35 GMT
> Hi,
> (Total VB newbie, plan to stay that way :-)
[quoted text clipped - 4 lines]
> For example is Now actually a value, e.g. in seconds where I could do:
> FormatDateTime(Now - 60 * 60 * 3, 0)

Try this:

   FormatDateTime(Now - 60 * 60 * 3 / 86400, 0)

Where  86400 is the number of seconds in a day (24 h).

Regards,

Stoil

> I bet that would be too easy...
> Colin
Martin Trump - 29 Sep 2004 16:37 GMT
>FormatDateTime(Now, 0) For example is Now actually a value, e.g. in
>seconds where I could do:
>FormatDateTime(Now - 60 * 60 * 3, 0)

Almost, but Now is in days and fractions of a day.

?format$(now,"hh:nn:ss")
16:35:28

?format$(now-1/24,"hh:nn:ss")
15:36:02

HTH.

Signature

Martin Trump

Martin Trump - 29 Sep 2004 16:43 GMT
Whoops, engage brain before posting. An addendum to my last posting.
You'll need to check id you're going back through midnight (noon as well
if you're using 24 hour clock time.

Regards

Signature

Martin Trump

eschuylerTAKE@THISadelphiaOUT.net - 29 Sep 2004 21:01 GMT
I think it's better to use the DateAdd() function, like this:

FormatDateTime(DateAdd("h", -3, Now), 0)

Regards,
Eric

>Hi,
>(Total VB newbie, plan to stay that way :-)
[quoted text clipped - 6 lines]
>I bet that would be too easy...
>Colin
Colin McNaught - 30 Sep 2004 18:42 GMT
Cool,
Looks like a great solution, thanks.
Colin

> I think it's better to use the DateAdd() function, like this:
>
[quoted text clipped - 13 lines]
> >I bet that would be too easy...
> >Colin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.