Register
It is currently Sun Apr 22, 2018 9:47 pm

kdialog and calendar


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Sat Mar 12, 2016 8:41 am   

Joined: Sat Mar 12, 2016 8:32 am
Posts: 2
I am new to this forum - so please excuse if my question seems to be stupid.

I am working on my first script making excessive use of kdialog. For naming scanned pages I like using the date as a starting point, so I tried to use

Code:
date=$(kdialog --calendar)


getting the date I choose returned. Is there any easy way of determine beforehand the structure of this output in the way %yyyy-%mm%dd?


Top
 Profile  
 PostPosted: Sat Mar 12, 2016 2:36 pm   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
Code:
#do NOT use command names as var names!!!
mydate=$(LANG=C kdialog --calendar "Choose your date" )
date -d "$mydate"  "+%Y-%m-%d"
As kdialog gives dates according to locale you have to call it with LANG=C to get a string back the command date can use.


Top
 Profile  
 PostPosted: Sun Mar 13, 2016 3:37 am   

Joined: Sat Mar 12, 2016 8:32 am
Posts: 2
Thanks for the hint - seems I have searched in the wrong place.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP