LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2017, 05:16 PM   #16
ethaniz3d
LQ Newbie
 
Registered: Aug 2017
Posts: 8

Original Poster
Rep: Reputation: Disabled

Code:
#!/bin/bash
set -xv
StartDate=$(date -d "2 days ago" +%m/%d/%Y)
EndDate=$(date -d  "6 days ago" +%m/%d/%Y)


curl  --data "StartDate=${StartDate}&EndDate=${EndDate}&xmlfile=xmlfile"
solved it. If i changed the %y to a %Y, it gave me the 4 digit year. Thank you very much for all your help!
 
Old 08-10-2017, 05:29 PM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,727

Rep: Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919Reputation: 5919
Look at the man pages for the date command. There is lots of info on its formatting options. If you still can't find the answer post back
 
Old 08-10-2017, 05:36 PM   #18
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
Glad to hear that worked!

If your problem is resolved please use the Thread Tools feature at top of the thread to mark it as SOLVED so that others looking for a similar solution will more easily find what works.

And again, welcome to LQ!
 
Old 08-11-2017, 12:31 AM   #19
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,897

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
Quote:
Originally Posted by ethaniz3d View Post
solved it. If i changed the %y to a %Y, it gave me the 4 digit year. Thank you very much for all your help!
If your problem is solved, please mark the thread solved.
Also, if you want to say thanks just click on yes.

Quote:
Originally Posted by ethaniz3d View Post
StartDate=$(date -d "2 days ago" +%m/%d/%Y)
EndDate=$(date -d "6 days ago" +%m/%d/%Y)
Finally - probably not important at all - StartDate is now "coming" 4 days after your EndDate
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Curl result to a variable in a Bash script Entropy1024 Linux - Newbie 2 10-29-2015 03:50 PM
[SOLVED] Bash script: How to assign variable to an sqlite3 command with variable embedded? ninja6o4 Linux - Software 10 02-15-2015 04:43 PM
[SOLVED] bash won't search within a variable with a user imputed variable hoisu Programming 8 04-02-2014 12:11 PM
Pass contents of variable to curl command hattori.hanzo Programming 1 07-23-2013 01:09 AM
Bash variable problem: cURL -b parameter (string form e.g. "name=value;n2=v2") sithemac Other *NIX 3 07-09-2008 06:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration