Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Time Post Reply Post New Topic
Author Message
tanikaz
Newbie
Newbie


Joined: 13 Oct 2014
Location: United States
Online Status: Offline
Posts: 5
Quote tanikaz Replybullet Topic: Date Time
     Posted: 13 Oct 2014 at 9:00am
Hello,
I am having trouble removing time from my date and time in crystal reports. For example if the date currently shows 12/10/14 12:06pm. I would like it to show 10/12/14 without the time.
I've tried left({datafield},len{datafield},-7)
Each entry has a different date and time but I would like to see the date only. thanks in advance.
tanika
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Oct 2014 at 9:07am
if it is a matter of display then you can
right click on the field
select format field
select Date and Time tab
select the date style you want to use from the list (or use the customize option)
 
If you need to convert or strip the time use
date(field)
 
IP IP Logged
tanikaz
Newbie
Newbie


Joined: 13 Oct 2014
Location: United States
Online Status: Offline
Posts: 5
Quote tanikaz Replybullet Posted: 13 Oct 2014 at 9:14am
DBlank,
Thank you date(field) worked!!!! Now to get the time do I put time(field)?
tanika
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Oct 2014 at 9:15am
correct
IP IP Logged
tanikaz
Newbie
Newbie


Joined: 13 Oct 2014
Location: United States
Online Status: Offline
Posts: 5
Quote tanikaz Replybullet Posted: 13 Oct 2014 at 9:16am
[IMG]smileys/smiley1.gif" align="middle" /> I appreciate it!

How would I remove the SS on the time? I would like it to read 11:55 am instead of 11:55:00 am. Military time would even be better. Thanks again.

Edited by tanikaz - 13 Oct 2014 at 9:19am
tanika
IP IP Logged
tanikaz
Newbie
Newbie


Joined: 13 Oct 2014
Location: United States
Online Status: Offline
Posts: 5
Quote tanikaz Replybullet Posted: 13 Oct 2014 at 9:44am
How would I remove the SS on the time? I would like it to read 11:55 am instead of 11:55:00 am. Military time would even be better. Thanks again I am a newbie. :)

tanika
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 Oct 2014 at 10:05am
again, the easiet way to make it display that way is
right click on the field
select format field option
select Date and Time tab
select the date style you want to use from the list (or use the customize option) the one you want for this is "13:23"
 
 
The other option would be to convert it to a string
Be aware that you now have a new data type so other calculations cannot be used on it.
totext(field,"HH:mm") //uses lead zeros
or
totext(field,"H:m") //uses no lead zeros


Edited by DBlank - 13 Oct 2014 at 10:28am
IP IP Logged
tanikaz
Newbie
Newbie


Joined: 13 Oct 2014
Location: United States
Online Status: Offline
Posts: 5
Quote tanikaz Replybullet Posted: 13 Oct 2014 at 10:26am
wonderful! Thank you.
tanika
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum