• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF 101. Time output format

LEGEND ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

Good morning all

I can't for the life of me figure out how to output today's day in this
format

July 06, 2006 09:28

My problem is the time. The server clock is 2 hours behind the clients time.
I need the time display +2 hours using the 12 hour clock

here's what I have so far
<cfset dateNow = Now()>
<cfset NewDate = '#LSDateFormat(dateNow, "mmmm d, yyyy")#
#LSTimeFormat(dateNow)#'>

Now to get the hours to display +2 without mucking things up once the hour
reaches 11:00

TIA

Bill


TOPICS
Advanced techniques

Views

211

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

Try

<cfset dateNow = dateAdd('h',2, Now())><!-- add 2 hours to the date and time now -->
<cfset NewDate = '#LSDateFormat(dateNow, "mmmm d, yyyy")# #LSTimeFormat(dateNow, 'hh:mm')#'>

Adding 2 hours to Now() means that it will roll over at the right point.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 06, 2006 Jul 06, 2006

Copy link to clipboard

Copied

LATEST
That's what I was after. Thanks a million.

Bill
"Beardydude" <webforumsuser@macromedia.com> wrote in message
news:e8j1g8$9rs$1@forums.macromedia.com...
> Try
>
> <cfset dateNow = dateAdd('h',2, Now())><!-- add 2 hours to the date and
> time
> now -->
> <cfset NewDate = '#LSDateFormat(dateNow, "mmmm d, yyyy")#
> #LSTimeFormat(dateNow, 'hh:mm')#'>
>
> Adding 2 hours to Now() means that it will roll over at the right point.
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation